Hi everybody, I'm having some trouble with this and could use your help.
I'm using Access 2010 and Windows 7.
I have a form called frm_Main_Form and created a Navigation Control with several forms in it.
In the header of frm_Main_Form, I created a combo box with a row source that is bound to an Associate Number field.
What I want to happen: whichever form the user selects in the Navigation Control and opens, it will automatically go to the record of the Associate Number referenced in the header combo box (I admit, I'm confused as to whether to call these subforms or not... when I click a button on the Navigation Control and the form opens up, is that a subform of frm_Main_Form?).
So to paint a picture... the user will select a name in the combo box control found in the header of frm_Main_Form and then, whichever Navigation Control button is chosen, it will open up to that record in the form.
I think the answer is some sort of after update code, but I'm not that good to write something like this.
As a starting point, I used some code I found elsewhere and tried to manipulate to my needs but was not successful, but tell me if it's a step in the right direction? Here's the code:
Any help would be greatly appreciated!!!!
I'm using Access 2010 and Windows 7.
I have a form called frm_Main_Form and created a Navigation Control with several forms in it.
In the header of frm_Main_Form, I created a combo box with a row source that is bound to an Associate Number field.
What I want to happen: whichever form the user selects in the Navigation Control and opens, it will automatically go to the record of the Associate Number referenced in the header combo box (I admit, I'm confused as to whether to call these subforms or not... when I click a button on the Navigation Control and the form opens up, is that a subform of frm_Main_Form?).
So to paint a picture... the user will select a name in the combo box control found in the header of frm_Main_Form and then, whichever Navigation Control button is chosen, it will open up to that record in the form.
I think the answer is some sort of after update code, but I'm not that good to write something like this.
As a starting point, I used some code I found elsewhere and tried to manipulate to my needs but was not successful, but tell me if it's a step in the right direction? Here's the code:
Code:
Option Compare Database
Private Sub cbo_AgentName_AfterUpdate() 'cbo_AgentName is the combo box on the header of frm_Main_Form
Dim rst As DAO.Recordset
Set rst = Forms!frm_Agent_Master.RecordsetClone 'frm_Agent_Master is one of several forms I can click to in the Navigation Control that I'd like to have automatically set to the same record as referenced in the combo box
rst.FindFirst "[AssociateNumber] = " & Forms!frm_Main_Form.[cbo_AgentName] '[AssociateNumber] is the text box control in frm_Agent_Master that is bound to that forms control source table
If Not rst.NoMatch Then
Me.Bookmark = rst.Bookmark
End If
End Sub
Any help would be greatly appreciated!!!!