pcc
Well-known Member
- Joined
- Jan 21, 2003
- Messages
- 1,382
- Office Version
- 2021
- Platform
- Windows
I have an Access database that contains names of chemical compounds, and am using SQL (generated via VB in Excel) to add records to/extract records from the database.
Some compound contain single and double quotes on their names eg
2,2′,2″-Trihydroxytriethylamine
This is causing a problem in parsing the SQL since, if I use a single ' as a text delimiter, it clashes wiith the ' in the substance name, and I get an error, but if is use " as a delimiter I get the same problem:
gives a problem because this resolves to
gives a problem because this resolves to
Can anyone advise a way out of this conundrum?
Some compound contain single and double quotes on their names eg
2,2′,2″-Trihydroxytriethylamine
This is causing a problem in parsing the SQL since, if I use a single ' as a text delimiter, it clashes wiith the ' in the substance name, and I get an error, but if is use " as a delimiter I get the same problem:
Code:
strsql = "Select material from CAS_number where material =""" & substance & """;"
Code:
Select material from CAS_number where material ="2,2′,2″-Trihydroxytriethylamine"
Code:
strsql = "Select material from CAS_number where material ='" & substance & "';"
Code:
Select material from CAS_number where material ='2,2′,2″-Trihydroxytriethylamine'
Can anyone advise a way out of this conundrum?