- 12,299
- Ealing-London
I am currently trying to get to grips with sql. Here is my problem.
I have a text input which becomes a variable, this variable is then checked against the database. If the variable matches a company name then that record is selected.
Here is what I have:
SELECT
Sheet1.ID,
"Sheet1.Co_Name",
Sheet1.Addr1,
Sheet1.Addr2,
Sheet1.Town,
Sheet1.City,
Sheet1.County,
Sheet1.Postcode,
Sheet1.FD_First,
"Sheet1.FD_Sur",
"Sheet1.FD_Title"
WHERE Sheet1.Co_Name=${Contact} <---- the variable
FROM
Sheet1
ORDER BY
Sheet1.ID,
Sheet1.Co_Name,
Sheet1.Addr1,
Sheet1.Addr2,
Sheet1.Town,
Sheet1.City,
Sheet1.County,
Sheet1.Postcode,
Sheet1.FD_First,
Sheet1.FD_Sur,
Sheet1.FD_Title
I get the error:
The SQL syntax check failed. Message returned from the database was:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[Sheet1.FD_Title]
Where Sheet1.Co_Name=avaya'. <--- the variable I entered (avaya is the name of a company in the database)
Why only one ' ?
Any help would be great
Dunc
I have a text input which becomes a variable, this variable is then checked against the database. If the variable matches a company name then that record is selected.
Here is what I have:
SELECT
Sheet1.ID,
"Sheet1.Co_Name",
Sheet1.Addr1,
Sheet1.Addr2,
Sheet1.Town,
Sheet1.City,
Sheet1.County,
Sheet1.Postcode,
Sheet1.FD_First,
"Sheet1.FD_Sur",
"Sheet1.FD_Title"
WHERE Sheet1.Co_Name=${Contact} <---- the variable
FROM
Sheet1
ORDER BY
Sheet1.ID,
Sheet1.Co_Name,
Sheet1.Addr1,
Sheet1.Addr2,
Sheet1.Town,
Sheet1.City,
Sheet1.County,
Sheet1.Postcode,
Sheet1.FD_First,
Sheet1.FD_Sur,
Sheet1.FD_Title
I get the error:
The SQL syntax check failed. Message returned from the database was:
[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression '[Sheet1.FD_Title]
Where Sheet1.Co_Name=avaya'. <--- the variable I entered (avaya is the name of a company in the database)
Why only one ' ?
Any help would be great
Dunc