SQL syntax

G

Guest

The following statement works great:

strSQL = "INSERT INTO CopyPtDemographics2 SELECT A.Address1, A.City, A.State
FROM CopyPtDemographics AS A INNER JOIN tblPatients AS B ON A.Address1 =
B.Pat_Addr WHERE A.Address1 = B.Pat_Addr"

However, if I add the field "A.First Name" into the query:

strSQL = "INSERT INTO CopyPtDemographics2 SELECT A.Address1, A.First Name,
A.City, A.State FROM CopyPtDemographics AS A INNER JOIN tblPatients AS B ON
A.Address1 = B.Pat_Addr WHERE A.Address1 = B.Pat_Addr"

I receive a "Syntax error (missing operator) in query expression 'A.First
Name' error message.

Changing the field name to "First_Name" doesn't help either - I then receive
an "Enter Parameter Value" dialog.

Unfortunately, "First Name" can't be changed - It's part of a legacy
database (that I didn't create).

Thanks.
 
A

Allen Browne

Add square brackets around the names that contain bad characters, e.g.:
[First Name]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top