0

I have those two tables (Members and Now) I just need to make sure that no one in Members is actually in Now. Both tables have different structures but can be joined on firsname, lastname and postalcode.

So I tried this (in access)

SELECT Members.Prenom, Members.Nom, Members.Adresse, Members.[Adresse 2], Members.ville, Members.Province, Members.CodePostal
FROM Members
Left JOIN now ON (members.prenom = now.firstname AND members.nom = now.lastname
AND members.codepostal = now.postcode) WHERE now.id IS NULL

And it gives me a wonderful error message

invalid use of '.' ' ' or '()'. in query expression

May someone enlighten me on what I did wrong?

4
  • What version of Access are you using again? Commented May 6, 2014 at 23:52
  • Members and members are not the same thing. Try matching the casing and see if your error is different Commented May 6, 2014 at 23:53
  • Pretty sure now is a restricted keyword? try wrapping `` around the columns Commented May 6, 2014 at 23:53
  • That would be 2007. The casing didn't change the error. Commented May 6, 2014 at 23:55

1 Answer 1

1

Pretty sure you cannot use 'now' as a table name, there are certain reserved words that MS Access need (in this case for function Now(), I guess the error message is telling you have missed the parentesis' ()). You could try encasing it in square brackets but I would strongly recommend changing your table name. A useful format I use is to prefix objects such as tblTableName, qryQueryName, rptReportName, frmFormName etc but whatever works for you.

SELECT Members.Prenom, Members.Nom, Members.Adresse, Members.[Adresse 2], 
    Members.ville, Members.Province, Members.CodePostal
FROM Members
Left JOIN [now] a ON (members.prenom = a.firstname AND members.nom = a.lastname
AND members.codepostal = a.postcode) WHERE a.id IS NULL
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.