Great! Now you see that when you pick something from the combo box, the information you want is known too. So after you update the combo by picking a value, you want code to push that information to other controls.
Select the City control
On the Property Sheet, click on the Event tab and then in the After Update event.
Click on the Builder Button ... off to the right.
This will put you into code between the Sub declaration and End Sub
Rather than telling you exactly what to do, I will give you some code you can modify:
- with me.City_controlname
-
if isnull(.value) then exit sub
-
me.District_controlname = .column(#)
-
me.State_controlname = .column(#)
-
end with
WHERE
City_controlname is the NAME property of the city controlname
District_controlname is the NAME property of the district controlname
State_controlname is the NAME property of the district controlname
# is the respective column number for the information (remember column numbering starts at 0 so 1 is really column 2
~~~~~~~~~ Add Option Explicit ~~~~~~~~~
if the top of your module does not have a statement that says Option Explicit, then add this:
- Option Explicit ' require variable declaration
~~~~~~~~~ Compile ~~~~~~~~~
Whenever you change code, references, or switch versions or operating environment, or modify objects with code behind them, you should always compile and save before executing.
from the menu in a VBE (module) window: Debug, Compile
(Alt-F11 to switch to the code window)
Fix any errors on the yellow highlighted lines.
Add needed references and remove missing references if necessary
(from the menu: Tools, References...)
keep compiling until nothing happens (this is good!) -- then Save
also be sure, before compiling, to use Option Explicit at the very TOP of each module so variables that are not declared or are misspelled will be picked up
~~~
if you made it to here without any problem, Save and test!