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

Access SQL Statement

Status
Not open for further replies.

Pholred

Programmer
May 10, 2005
1
GB
I have an Access Database, one of the forms has a text box that is read only (text58)this contains a customer number (this customer is brought out by the query that generates the page). I have another text box (text41), I need to display the answer to an SQL statement in text41.
This SQL statement uses the customer number in text58 to pull out the corresponding customer name I just need help with the SQL statement that is going to sit in VB code behind text box text41, i think its something along the lines of

Private Sub Text41_AfterUpdate(Cancel As Integer)

Text41.text = “SELECT [customer name] FROM tblcustomers WHERE [customer number] LIKE '" + Text58.TEXT + "'”

End Sub

But I cant get it to work

Any help would be most grateful

 
Me!Text41 = DLookUp("[customer name]", "tblcustomers", "[customer number]='" & Me!Text58 & "'")

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top