It took forever to get the following line to work in VBA:
Set rst = dbs.OpenRecordset("Select [LocationName] from PWS where [LocationNumber] = '" & Me.LocationNumber & "';")
Now I am trying to get the following line of code to run with no success:
Set rst = dbs.OpenRecordset("Select [LocationName] from PWS where [LocationNumber] = '" & Me.LocationNumber And Me.PWSName = PWS.PWSName & "';")
I am having the hardest time figuring out quotes, semicolons etc.. using vba.
No problem just writing the sql statement in sql designer, and running the saved query. Punctuating the sql statement so it will run in VBA has been frustrating to put it mildly. Can anyone write this line of code so it will run in vba.
Can someone point me to a clear and understandable explanation of how punctuation works in vba??
Thanks,
B
Set rst = dbs.OpenRecordset("Select [LocationName] from PWS where [LocationNumber] = '" & Me.LocationNumber & "';")
Now I am trying to get the following line of code to run with no success:
Set rst = dbs.OpenRecordset("Select [LocationName] from PWS where [LocationNumber] = '" & Me.LocationNumber And Me.PWSName = PWS.PWSName & "';")
I am having the hardest time figuring out quotes, semicolons etc.. using vba.
No problem just writing the sql statement in sql designer, and running the saved query. Punctuating the sql statement so it will run in VBA has been frustrating to put it mildly. Can anyone write this line of code so it will run in vba.
Can someone point me to a clear and understandable explanation of how punctuation works in vba??
Thanks,
B