Member Login

Username
Password
Forget Password
New Sign Up
Search Forum

Buy Support
Incidents

If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:

Click Here
If you can't login and post questions or you are having trouble viewing forum posts:
Click Here
Callback
Support

If you live in USA, UK, Canada, Australia or New Zealand, you can leave us details on your question and request us to call you back and discuss them with you personally  (charges apply).

Click Here
 
Buy Support
Incidents
If you can't find your answer in the FREE PUBLIC QDeveloper Forum, require URGENT Priority Support, or you need to send us private or confidential information:
Click Here

Forum : Apostrophe / Single Quotes Problem SolutionSearch Forum

Forum Home > QODBC - ODBC Driver for QuickBooks > QODBC v8 Forum

 New Topic 
 
 Post Reply 
[1]  
 Apostrophe / Single Quotes Problem Solution 
 Author   Message 
  Flash 
  
 Group: Members 
 Posts: 27 
 Joined: 2006-10-22 
 Profile
 Posted : 2008-04-01 02:24:48

Driving you nuts?

Here is a solution that is between perfect and acceptable.

Replace all apostrophes with `. That is the character below the ~ on your keyboard.

Or Chr(96)

Use this or a similar function:

Function fncTakeOutApostrophes(strNEW As String) As String
If IsNull(strNEW) = True Or Len(strNEW) = 0 Then
fncTakeOutApostrophes = " "
Exit Function
End If

Dim ap As Boolean
ap = True
    Do While ap = True
        If InStr(1, strNEW, "'", vbTextCompare) > 0 Then
        i = InStr(1, strNEW, "'", vbTextCompare)
            strNEW = Left(strNEW, i - 1) & Chr(96) & Mid(strNEW, i + 1, Len(strNEW))
        Else
            ap = False
        End If
    Loop
    fncTakeOutApostrophes = Trim(strNEW)
End Function

 

Hey! A backwards single quote is better than no single quote at all!!!

 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-04-01 08:46:58

The normal solution is to replace each single quote with two consecutive single quotes. Pseudo example: O'Conner is changed to O''Conner

INSERT INTO "customer" ("Name","LastName","FirstName","BillAddressAddr1",
"BillAddressAddr2","BillAddressCity","BillAddressState","BillAddressPostalcode")
values ('O''Conner, Shane','O''Conner','Shane','Shane O''Conner','561 W 4th St.',
'Carlsbad','CA','92009')

This insert is seen in QuickBooks as O'Conner

 

  Top 
  Flash 
  
 Group: Members 
 Posts: 27 
 Joined: 2006-10-22 
 Profile
 Posted : 2008-04-01 11:24:59

Well shiver me timbers!

First, I searched the forum for 'apostrophe' and not coming up with any solutions, figured out my own.

I did not know that:

  1. double quotes could be placed inside the single quotes
  2. QuickBooks would read these as single quotes!

Fantastic!! So glad I posted my somewhat bizzare solultion since now I have this great one and other people searching for apostrophe will find your solution too!

Thanks Tom.

 

  Top 
  Flash 
  
 Group: Members 
 Posts: 27 
 Joined: 2006-10-22 
 Profile
 Posted : 2008-04-01 11:42:35
 Uh oh, Tom. Your solution, though great for names, doesn't work in the customer notes field where I was trying to use apostrophes. Guess I'll go back to my backwards method for now. Unless you have another great solution for me! 

  Top 
  Tom 
  6c3c1_sdk-qodbc.gif
 Group: Administrator 
 Posts: 5510 
 Joined: 2006-02-17 
 Profile
 Posted : 2008-04-01 14:10:37
Sorry, note fields are handled differently, they are limited to 4095 characters and the text cannot contain any special characters like ' or  , (quotes or commas). See: How do I insert data into the Timetracking table? and where are my carriage returns/linefeeds? for more. 

  Top 
 New Topic 
 
 Post Reply 
[1]  

Jump to