Hello,
I'm relatively new to access/VBA, and am trying to use a button to open a new form (Form2). When the new form is opened, I'd like to find the same record that was displayed on the original form (Form1). Both Form1 and Form2 use a combo box with form/subform to select records. The VBA for this combo box is below.
I'm currently using a control button with embedded macro to open Form2, but am having trouble setting the control to also find the appropriate record.
Here's the VBA used on the combo box for Form1 and Form2:
Private Sub Combo165_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo165], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo165 = Null
End Sub
Thanks for any suggestions!
I'm relatively new to access/VBA, and am trying to use a button to open a new form (Form2). When the new form is opened, I'd like to find the same record that was displayed on the original form (Form1). Both Form1 and Form2 use a combo box with form/subform to select records. The VBA for this combo box is below.
I'm currently using a control button with embedded macro to open Form2, but am having trouble setting the control to also find the appropriate record.
Here's the VBA used on the combo box for Form1 and Form2:
Private Sub Combo165_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Nz(Me![Combo165], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Combo165 = Null
End Sub
Thanks for any suggestions!