Computing.Net > Forums > Programming > Access Form

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Click here to start participating now! Also, check out the New User Guide.

Access Form

Reply to Message Icon

Name: fholred
Date: March 13, 2006 at 13:34:19 Pacific
OS: Windows XP
CPU/Ram: Athlon 3000XP/1GB
Comment:

I have an Access Database, one of the forms has a text box that is read only (text58)this contains a customer number. 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 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



Sponsored Link
Ads by Google

Response Number 1
Name: Chi Happens
Date: March 14, 2006 at 06:32:01 Pacific
Reply:

Probably needs to be:

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

VB uses ampersands to concatenate strings.

The LIKE statement requests you to use the search macro % (it might be different for Access, but % is TSQL and it should work)

Hope this helps,
Chi

They mostly come at night...mostly.


0

Response Number 2
Name: mdow
Date: March 14, 2006 at 06:36:40 Pacific
Reply:

I would use the dlookup function for this.

me.Text41 = dlookup("Customer Name","tblcustomers","Customer Number = " & me.Text58

I would also put this in the Form's On Current Event.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More


A C++ question. Visual Basic Express 2005...



Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Access Form

Convert Access Forms to Visual Basi www.computing.net/answers/programming/convert-access-forms-to-visual-basi/3175.html

Browse Hard Drive in MS Access Form www.computing.net/answers/programming/browse-hard-drive-in-ms-access-form/9857.html

Open a cash drawer in access www.computing.net/answers/programming/open-a-cash-drawer-in-access/10780.html