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
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