View Single Post
  #2 (permalink)  
Old May 17th, 2007, 12:50 PM
mmcdonal mmcdonal is offline
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Hi, this is pretty common.

Create a module and declare some public variables. Since these are combo boxes, I am going to assume they are bound to PKs, so the public variable should be integers.

Public pCombo1, pCombo2, pCombo3 As Integer

Now these are available throughout your VBA without declaration.

When you move from the first form with your selections to your second form with combo boxes (already made up and displaying meaningful fields) then do this on the first form's button's on click event:

pCombo1 = Me.SelectedField
pCombo2 = Me.NextSelectedField

etc, or where ever they are coming from. If they are not integer values, then you will need to modify the code accordingly.

Then on the On Load or On Open event of the second form, put this code:

Me.Combo1 = pCombo1
Me.Combo2 = pCombo2

Of course, on the first form you will want to make sure that each filed has a value to pass, otherwise substitute another value.

Does this get you started?

Reply With Quote