Passing Combo Box Values Between Forms

chris-evans

Board Regular
Joined
Feb 19, 2002
Messages
73
Hi all

I have a question regarding Access 2000.

I currently have a database with a number of forms in it. All the forms have a similar format but show a slightly different cut of the same data. On each form there is one common drop down box that allows the user to select a brand as a filter for the data. I also have a number of buttons on each form that will allow the user to close one form and open another view of the data.

The only snag is, each time a new form opens the user has to reselect the brand they are looking at (which is quite frustrating!)

Is there a way to trap the current brand selected on closing a form and use that as the combobox value in the new form that is opening? (I assume this must be possible in VBA).

Below is the code that is currently used for changing the combobox and also on opening a new form.

Would someone be kind enough to provide me with some guidance on how to change the code?

Many thanks

Chris

Here is the Combobox filter code:

Private Sub Combo34_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Brand Name] = '" & Me![Combo34] & "'"
Me.Bookmark = rs.Bookmark
End Sub

This is the code I am using to open and close forms:

Private Sub Go_To_Top_Level_Click()
On Error GoTo Err_Go_To_Top_Level_Click

Dim stDocName As String
Dim stLinkCriteria As String

DoCmd.Close

stDocName = "Total Brand Financials - Form"
DoCmd.OpenForm stDocName


Exit_Go_To_Top_Level_Click:
Exit Sub

Err_Go_To_Top_Level_Click:
MsgBox Err.Description
Resume Exit_Go_To_Top_Level_Click

End Sub
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
If you look up "OpenArgs Property" in help you should find what you need :)

Shout back if you need more specific help

Peter
 
Upvote 0

Forum statistics

Threads
1,221,645
Messages
6,161,044
Members
451,682
Latest member
ogoreo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top