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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I need help in joining two SQL sele

Status
Not open for further replies.

lalee5

Technical User
Oct 20, 2002
70
US
I need help in joining two SQL select statement.


it works if I don't add the and Etc....

But I need the sql to do both. Please edit the following for me.
I need records only if the name and phone number is the same as my text field.




Thanks, Kay


stcnQL2 = "SELECT * FROM tappointments where custname=" & "'" + Text12.Text + "'" And "SELECT * FROM tappointments where custphone=" & "'" + Text13.Text + "'"
 
Kay,

I think all you need to do is expand your where clause. Your query should look like this:

stcnQL2 = "SELECT * FROM tappointments where custname='" & Text12.Text & "' and custphone='" & text13.text & "'"

No need to do a join because all your info is in one table you just need to expand your where clause.

Also I should note that assembling the query this way probably opens you to some security risk depending on how these text fields are being entered. You may want to look into use the parameters collection.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top