Hi all - interesting situation that I encountered in one of my databases.
The idea of using a combo box to populate a form is fairly simple - select an item from the combo box and all the corresponding information from the tables is populated in the form - simple.
I have a form that is used for data input and data editing, it is exactly the same form for each function except that depending on how you open it, a show/hide macro displays a different combo box.
When the form is opened with method a), that is the first combo box is shown, everything works fine - the header information and the subform update on selection to reflect the appropriate information.
However, when the form is opened with method b), that is the first combo box is hidden and the second combo box is shown, the header information updates fine but the subform will not update. The code behind each combo box is as follows:
a)
Private Sub IR_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IR] = " & Str(Nz(Me![IR], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
b)
Private Sub IR_Revisions_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IR] = " & Str(Nz(Me![IR_Revisions], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
[IR] is the combo box that works, [IR_Revisions] is the one where the subform doesn't update. Any help or thoughts would be appreciated.
-Robert
The idea of using a combo box to populate a form is fairly simple - select an item from the combo box and all the corresponding information from the tables is populated in the form - simple.
I have a form that is used for data input and data editing, it is exactly the same form for each function except that depending on how you open it, a show/hide macro displays a different combo box.
When the form is opened with method a), that is the first combo box is shown, everything works fine - the header information and the subform update on selection to reflect the appropriate information.
However, when the form is opened with method b), that is the first combo box is hidden and the second combo box is shown, the header information updates fine but the subform will not update. The code behind each combo box is as follows:
a)
Private Sub IR_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IR] = " & Str(Nz(Me![IR], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
b)
Private Sub IR_Revisions_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[IR] = " & Str(Nz(Me![IR_Revisions], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub
[IR] is the combo box that works, [IR_Revisions] is the one where the subform doesn't update. Any help or thoughts would be appreciated.
-Robert