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

SQL Syntax help

Status
Not open for further replies.

gtobey

Programmer
Aug 29, 2000
11
US
Attempting to use the following code to populate some SQL with the contents of a Textbox. Any tips as to what is wrong wrong would be apprecaited.

Set rst = dbs.OpenRecordset("Select * FROM Contact " _
& "WHERE Contact.Name = " & Me!txtName)

I've tried using parts of the Where clause from the Query design facility, but cannot get that to work either.
SELECT Contact.ID, Contact.Name, Contact.Phone, Contact.Notes
FROM Contact
WHERE (((Contact.Name)=[Forms]![frmTest]![txtName]));
 
Set rst = dbs.OpenRecordset("Select * FROM Contact " _
& "WHERE Contact.Name = '" & Me!txtName & "'")
need quotes around text
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top