Run time error 3075 - help please

P

Phil Hood

When I run the following code (bottom), I get an error:

-------------------------
Run time error 3075
Syntax error (missing operator) in query expression
'((([ResultDescription.ResultDesc]) = First Place))'

Forms![Heat]![Results subform].Form![Result] contains a
string i.e. First Place
-------------------------

I can't work out what is wrong. Help please!


Dim strQuerySQL6 As String
Dim x As String

Set dbsCurrent = CurrentDb

strQuerySQL6 = "SELECT ResultDescription.* FROM
ResultDescription WHERE ((([ResultDescription.ResultDesc])
= " & Forms![Heat]![Results subform].Form![Result] & "));"

Set rstPoints = dbsCurrent.OpenRecordset(strQuerySQL6)
 
P

PC Datasheet

Strings must be enclosed in quotes. Change this line to:
= '" & Forms![Heat]![Results subform].Form![Result] & "'));"
 
P

Phil Hood

Thanks, it works now.

-----Original Message-----
Strings must be enclosed in quotes. Change this line to:
= '" & Forms![Heat]![Results subform].Form![Result] & "'));"


--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com



Phil Hood said:
When I run the following code (bottom), I get an error:

-------------------------
Run time error 3075
Syntax error (missing operator) in query expression
'((([ResultDescription.ResultDesc]) = First Place))'

Forms![Heat]![Results subform].Form![Result] contains a
string i.e. First Place
-------------------------

I can't work out what is wrong. Help please!


Dim strQuerySQL6 As String
Dim x As String

Set dbsCurrent = CurrentDb

strQuerySQL6 = "SELECT ResultDescription.* FROM
ResultDescription WHERE ((([ResultDescription.ResultDesc])
= " & Forms![Heat]![Results subform].Form![Result] & "));"

Set rstPoints = dbsCurrent.OpenRecordset(strQuerySQL6)


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top