Correct dcount syntax for AND criteria?

Happy YN

Registered User.
Local time
Today, 09:25
Joined
Jan 27, 2002
Messages
425
Can anyone please correct my code - I can't seem to get round the & and " and ' parts . Perhaps someone can point me to a good article about all this Thanks

Code:
If (DCount("*", "tblprinter", "[strprinter] = '" & [Forms]![frmbook]![TxtAddPrinter] & "'AND [strcity]= '" & [Forms]![frmbook]![TxtAddCity])) > 0 Then
etc......
 
The single quotes are not needed, it is a string you are supplying, not a string whithin a string. I would also supply a column name instead of the * in the first reference, but I have never tried the * so I am not sure about that, help says to specify a column or a calculation on the data contained in a column.
 
Thanks Pat. Looking at it now I can see everything is nicely paired.Still wouldn't mind an article on single and double quotes and ampersand??
 

Users who are viewing this thread

Back
Top Bottom