By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,027 Members | 1,261 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,027 IT Pros & Developers. It's quick & easy.

when the list box is changed i want the text box to update

P: 1
I'm new to Access. I am using Access 2003. I have a list box and a text box next to it. when a user clicks on the down arrow key and changes the list box i want the text box next to it to make the change also. right now i have this in the Control Source:
=DLookUp("[CPT]","[tblProcedure]","[Procedure]=forms![contacts]![combo186]")

i don't have anything in Onchange event in the list box properties or Afterupdate event in the text box properties.

what do i need to do exactly to get this to work?

thank you in advance!
Dec 4 '06 #1
Share this Question
Share on Google+
2 Replies


ADezii
Expert 5K+
P: 8,669
I'm new to Access. I am using Access 2003. I have a list box and a text box next to it. when a user clicks on the down arrow key and changes the list box i want the text box next to it to make the change also. right now i have this in the Control Source:
=DLookUp("[CPT]","[tblProcedure]","[Procedure]=forms![contacts]![combo186]")

i don't have anything in Onchange event in the list box properties or Afterupdate event in the text box properties.

what do i need to do exactly to get this to work?

thank you in advance!
'This sample code snippet should help you. The assumptions are: Listbox Name
'is lstTest, the Text Box name is txtLocation, and you wish to populate the
'Text Box with a Location corresponding to the specific ID generated from the
'Combo Box:

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboTest_AfterUpdate()
  2. Me![txtLocation] = DLookup("[StorLocName]", "tblStorLoc", "[StorLocID]=" &  Me![cboTest])
  3. End Sub
Dec 4 '06 #2

NeoPa
Expert Mod 15k+
P: 31,615
Assuming the ComboBox is populated from tblProcedure too (if not just ignore this post) then another way would be to populate the ComboBox with two columns.
One to display and select on ([Procedure]) and the other to return a value ([CPT]).
That way, when someone selects a [Procedure] the value of the ComboBox is automatically set to [CPT].
Dec 4 '06 #3

Post your reply

Sign in to post your reply or Sign up for a free account.