Variables with " in them.

muzza79

Registered User.
Local time
Today, 02:18
Joined
Oct 5, 2004
Messages
12
Hi,

I have an access database where I am using DLookup to find a value as follows.

Code:
strLine = Forms!frmDataRecord!cmbLineID

strInsulation = DLookup("[Insulation]", "[Piping Data]", "[Line Identifier] = " & strLine)

My Problem is that strLine contains a value such as PL-10006-8'' and i think that the quotation on the end is causing problems as I recieve the following error message.

Run-Time error '3075':
Syntax error (missing operator) in query expression '[Line Identifier] = PL-10006-8"'


Can anyone suggest a method to allow me to use a value such as that?

Thanks in Advance
 
either check it over and replace it with single quotes (if you can) or look up how to do parameterised lookups on google.
 
I believe your syntax is wrong for a string, try:
Code:
strInsulation = DLookup("[Insulation]", "[Piping Data]", "[Line Identifier] = '" & strLine & "'")
 
Muzza,

RG's syntax is correct.

That will let you retrieve your values with a double-quote in them.

If you have a mixture of single-quotes/double-quotes in your data,
you'll have to get creative with the Replace statement.

Wayne
 

Users who are viewing this thread

Back
Top Bottom