Brain Dead (1 Viewer)

Davef28

Registered User.
Local time
Today, 04:27
Joined
Feb 6, 2002
Messages
51
I have following code (PREVIOUS POST WAS INCORRECT)

strOrder = "[Customer Name] = '" & [Forms]![Customer Add]![Customer Name] & "'" & " " & "AND" & " " & "[Customer Day] = '" & [Forms]![Customer Add]![DayPass] & "'"

[Forms]![Customer Add]![Customer Name] can have an apostrophe in it which causes a problem with syntax. I know this is probably really easy but my brain seems to not function this morning. What other delimeter can I use ie you use # for time ?

thanks
 
Last edited:

Fizzio

Chief Torturer
Local time
Today, 04:27
Joined
Feb 21, 2002
Messages
1,885
Try using double quotes rather than single ie.

strOrder = "[Customer Name] = """ & [Forms]![Customer Add]![Customer Name] & """ & " AND [Customer Day] = '" & [Forms]![Customer Add]![DayPass] & '"

HTH
 

Davef28

Registered User.
Local time
Today, 04:27
Joined
Feb 6, 2002
Messages
51
No luck I am afraid.
 

Fizzio

Chief Torturer
Local time
Today, 04:27
Joined
Feb 21, 2002
Messages
1,885
The syntax may not be correct but the principle is. I have not got access to MS Access at the minute so I cannot test it out. Are you using the string to filter something? You may consider using the customer ID (via a DLookup) to filter rather than the name as it potentially could be duplicated.
 

Davef28

Registered User.
Local time
Today, 04:27
Joined
Feb 6, 2002
Messages
51
Yes, I realise the principle is. It must be just a case of getting the correct number of " or ' . I cannot do a DLookup because the Customer Name will be duplicated, the other fields won't.

I will keep trying, thanks.
 

cogent1

Registered User.
Local time
Today, 04:27
Joined
May 20, 2002
Messages
315
OK try this ;


strOrder = "[Customer Name] = """ & [Forms]![Customer Add]![Customer Name] & """" & " AND " & "[Customer Day] = '" & [Forms]![Customer Add]![DayPass] & "'"


That worked for me. You have redundant quotes in your SQL, you can just pad the AND with spaces
 

Users who are viewing this thread

Top Bottom