Jump to content

Inner Joins - Multiple Criteria


ameliabob
 Share

Recommended Posts

I am trying to find away to do a search to find matched records. I have put together the following code

Dim sleuths As Recordset, newsleuths As RecordsetDim qry As StringDim dbs As DatabaseDim ctr As Integer, ans As Recordset    ctr = 0    Set dbs = CurrentDb    qry = "SELECT * FROM NewSleuths JOIN SLEUTHS ON NewSleuths.FirstName=SLEUTHS.FirstName AND NewSleuths.LastName = SLEUTHS.LastName"    Set newsleuths = dbs.OpenRecordset(qry, dbOpenDynaset)

When I try to execute this I get a message that there is an error in the FROM clause. Can I not have an AND condition in the ON?

Link to comment
Share on other sites

you need to specify the column names instead of wild card (*)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...