Link to home
Start Free TrialLog in
Avatar of mcs26
mcs26

asked on

SQL Query with apostrophe

Hi,

I have an access database where I insert some records into my table. The records are file names from certain folders. The query works fine (please see the code below).

The only issue is when a file name has an apostrophe in it. For example a file called "Word Documents" would work fine, however a file called "Word Document's" would not work becuase of the apostrophe.

Any help would be great.

Thanks,
M

                strSQL = "INSERT INTO tblCompanyFiles ([Ticker], [Folder], [FileName], [DocType]) " & _
                            "VALUES ('" & Ticker & "','" & objFolder.Name & "','" & objFile.Name & "','" & DocType & "');"
                            
                DoCmd.RunSQL strSQL   

Open in new window

SOLUTION
Avatar of Cluskitt
Cluskitt
Flag of Portugal image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial