Computing.Net > Forums > Programming > Access Form

Computing.Net: Over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to sign up now, it's free!

Access Form

Reply to Message Icon

Original Message
Name: fholred
Date: March 13, 2006 at 13:34:19 Pacific
Subject: Access Form
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


Report Offensive Message For Removal


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.


Report Offensive Follow Up For Removal

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.


Report Offensive Follow Up For Removal







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



Results for: Access Form

Convert Access Forms to Visual Basi
    Summary: Is there a way to convert Access forms to Visual Basic (lets say 6.0 for example) to create EXE with them ? ...
www.computing.net/answers/programming/convert-access-forms-to-visual-basi/3175.html

Browse Hard Drive in MS Access Form
    Summary: I am building a MS Access form. In one of the fields, I want the user to specify a file on the hard drive, to be used later. How do I set the field up to allow the user to browse through the folders o...
www.computing.net/answers/programming/browse-hard-drive-in-ms-access-form/9857.html

Form to email??
    Summary: you need to get the information within the previewmailto.asp code like this: Dim SendTo Dim SendFrom Dim Subject Dim URL SendTo = Request.Form("sendto") SendFrom = Request.Form("email") Subject = Requ...
www.computing.net/answers/programming/form-to-email/7694.html








Which MP3 player do you have?

iPod/iPhone
Zune
Something Else
None


View Results

Poll Finishes In 2 Days.
Discuss in The Lounge
Poll History






Data Recovery Software