Try...
sql2 = "SELECT tblCustRMAs.CompanyName, tblCustRMAs.CustID " & _
"FROM tblCustRMAs " & _
"WHERE tblCustRMAs.CompanyName = " & Chr(34) & CurrentCustName & Chr(34)
";"
bronicabill <[EMAIL PROTECTED]> wrote:
I'm having a problem with a syntax error in an SQL statement inside of
some code I'm working on. Some records in one of the the data fields
I'm trying to query have an apostophe in the name (it is a customer's
name, so it should be spelled correctly if possible, including the
apostrophe), and that is causing the following SQL statement to give a
syntax error whenever one of those records is reached:
sql2 = "SELECT tblCustRMAs.CompanyName, tblCustRMAs.CustID " & _
"FROM tblCustRMAs " & _
"WHERE (((tblCustRMAs.CompanyName)= '" & CurrentCustName & "'));"
If anyone can suggest a change to this statement so that records with
apostrophes in the Company Name field will not cause it to crash, I
would greatly appreciate it!
Many thanks,
Bill R.
SPONSORED LINKS
Microsoft access database Database development software Database
management software Database software Inventory database software
Membership database software
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "ms_access" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
May God bless you beyond your imagination!
Lonnie Johnson
ProDev, Professional Development of MS Access Databases
Visit me at ==> http://www.prodev.us
---------------------------------
Yahoo! Mail - Helps protect you from nasty viruses.
[Non-text portions of this message have been removed]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/ms_access/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/