Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SELECT Statement sought

Status
Not open for further replies.

Micash

Programmer
Dec 11, 2000
54
Hi Guys
could someone help me with what might be quite a simple statement, but I am strggling with it.

I need to create a table that will populate with all the records that have two specified ID numbers.
I can do it to see a list of all records with one ID Number:
Example:
with datPeople
.Recordsource = "SELECT * FROM People WHERE IDNo =" & "'" & strID1 & "'"
.refresh
End With

I want to get a list showing records for strID1 and strID2
How is the statement sset up if possible
Regards
Micash
 
You can use
Code:
   .Recordsource = "SELECT * FROM People " & _
                   "WHERE IDNo ='" & strID1 & "' OR " & _
                   "      IDNo ='" & StrID2 & "'"
OR
Code:
   .Recordsource = "SELECT * FROM People " & _
                   "WHERE IDNo IN ('" & strID1 & "','"  & StrID2 &  "')"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top