Populating text boxes from a list box

seanog2001

Registered User.
Local time
Today, 05:06
Joined
Jun 26, 2006
Messages
67
Hi

I am trying to populate text boxes with data from a table. The type of data is dependent on what name you select from a list box.

if the user selects a certain name from the list box i want to populate the text box with certain information about that person from the table that his/her data is stored.

do i use the onClick event to try and code some sort of event or does any one else have any solutions.
 
Assuming you have a listbox and the fields that need to be filled all on the same form. You need to enter this code in the AfterUpdate property of the listbox. You will need to make sure the query behind the listbox does contain all the fields you need to populate the text boxes. Code from Access97

Code:
Dim rs As Object

    Set rs = Me.RecordsetClone
    rs.FindFirst "[YourDataID] = " & Str(Me![ListBoxName])
    Me.Bookmark = rs.Bookmark

Col
 
ColinEssex said:
Assuming you have a listbox and the fields that need to be filled all on the same form. You need to enter this code in the AfterUpdate property of the listbox. You will need to make sure the query behind the listbox does contain all the fields you need to populate the text boxes. Code from Access97

Code:
Dim rs As Object

    Set rs = Me.RecordsetClone
    rs.FindFirst "[YourDataID] = " & Str(Me![ListBoxName])
    Me.Bookmark = rs.Bookmark

Col

What is this piece of code actually doing ive typed it into vb and getting an error on the

Set rs = Me.RecordsetClone
 
Are you using Access97?

The code is making a clone of the record and placing it in the text fields on the form.

Col
 
ColinEssex said:
Are you using Access97?

The code is making a clone of the record and placing it in the text fields on the form.

Col

No sorry its Access 2000 any tips on where i could find some info on what i want to do.
 
Here's a sample in A2000 of what I think you're trying to do.

Col

ps - my thanks to the unknown author.
 

Attachments

ColinEssex said:
Here's a sample in A2000 of what I think you're trying to do.

Col

ps - my thanks to the unknown author.


thanks bud ill work with this and see how I get on
 

Users who are viewing this thread

Back
Top Bottom