simple questions about loading data from dropdown

swarv

Registered User.
Local time
Today, 22:42
Joined
Dec 2, 2008
Messages
196
Hi all,

I have a drop-down box (combo136) and I would like to so show a record when the user clicks a name in the list.

It sounds so simple but im struggling.

I would like to place the code in the sub in vba:
Private Sub Combo136_AfterUpdate()

the table I would like to get the data from is tbl_users.

so for example the user would choose say Martin Storey and then access would look in the table tbl_users and then accross to field daysworkedperweek and then place the number that is in there into a textbox on the form.

Any help would be very very gratefully received.

Thanks

Martin
 
This is the query code I have but I want it done in VBA. And also "abbe" needs to be the value in combo136.

SELECT tbl_users.daysperweek, tbl_users.Name
FROM tbl_users
WHERE (((tbl_users.User_id)="Abbe"));

Thanks
 
You could either do a Dlookup, or add the field you need to combo136 recordsource and put this in the ControlSource of your textbox:

Code:
=combo136.Column(x)

Where x is the columnnumber of "daysworkedperweek"

JR
 
JR,

I have:
=[combo136].[Column]([3])
but where do I place it? If it put it in the control source of the next text box it doesn't get updated.

Thanks.
 
If you wanna update by setting the controlsource to a bound field, the you must go the Dlookup route. But it looks like you are storing data twice in difrent tables which usually isen't PC. ;)

JR
 
many thanks - got it working, knew it was something simple.

Thanks
 

Users who are viewing this thread

Back
Top Bottom