p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   Access VBA (http://p2p.wrox.com/forumdisplay.php?f=80)
-   -   Combo Box dependent transferred to another form (http://p2p.wrox.com/showthread.php?t=57992)

Ebaad May 17th, 2007 04:07 AM

Combo Box dependent transferred to another form

I have a situation in developing an access form, that I need to display the values from a record as the selected values in the dependent combo boxes. This I could do on the web with ASP code but this is my first time building an access form as according to the higher powers I cannot host anything on the web, so I have to create a vb - access frontend that can be shared on a network drive.

I would really appreciate any help.


mmcdonal May 17th, 2007 12:50 PM

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?


All times are GMT -4. The time now is 06:40 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.