Fill in a form control based on another control

rap1971

Registered User.
Local time
Today, 17:26
Joined
Jan 16, 2001
Messages
23
I want to automatically fill in a text box on my form based on the selection in the previous list box. I know how to do this in Oracle...love those post-text triggers...but can't seem to get it right in Access.
i.e. I have a Sales_Reps table with Rep_ID, Rep_name and Rep_phone (among others) fields. The list box pulls the Rep_ID (which is hidden) and the Rep_name. Once a Rep_name is selected, I want the phone text box on the form to automatically fill in with the reps phone number.

Please help!

**Wherever you go, there you are**
 
Include the phone number column in the combobox query as the third field (you don't need to display it). Then in the AfterUpdate event of the combobox, set the value of an unbound control to display the phone number.

Me.UnboundTextBox = Me.YourCombo.Column(2)

The column index for combobox record sources is zero based so (2) actually refers to the third column. Sort of like the way the rest (non-US) of the world views the floor numbers of buildings.
 
Bravo!
It works...thank you so much! I had been beating my head against a wall for days! (I'm not real good with VB...so this really made my day!)

Thank you, thank you, thank you.
 
P.S.
What does the Me stand for/do in that line of code?
 
the Me. references the Current Form.

Instead of typing
Forms![CurrentForm]![ControlName]

you type

Me.[ControlName]

Duane Barker
 

Users who are viewing this thread

Back
Top Bottom