TheStriker
Registered User.
- Local time
- Today, 16:58
- Joined
- Jan 5, 2004
- Messages
- 17
Hi,
I am using Access 2000 and I am having a bit of trouble trying to update a subform when the user selects an option from the listbox. The subforms were created by the wizard so the child/master fields were created successfully. The listbox was also created by the wizard with the option of:
'Find a record on my form based on the value I selected in my list box'
This option makes the listbox unbound and produces the following code in VBA:
***********************************************************
Private Sub ListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SiteID] = " & Str(Me![List2])
Me.Bookmark = rs.Bookmark
End Sub
***********************************************************
I've also inserted the 'Me.Form.Requery' or 'Me.[ListBox].Requery' procedure in the On Current Event of the subform.
What I am trying to accomplish is to update the subform on which the listbox resides once the user selects a record from the listbox. The fields on the subform will populate corresponding with the selected record. The code produced by the wizard is sufficient for that when viewed in the subform itself, however when I open the main form and select from the same listbox, the subform won't update. I've even tried to requery/refresh/repaint the main form but to no avail. I hope this is enough information to provide a suggestion. Thanks in advance.
TheStriker
I am using Access 2000 and I am having a bit of trouble trying to update a subform when the user selects an option from the listbox. The subforms were created by the wizard so the child/master fields were created successfully. The listbox was also created by the wizard with the option of:
'Find a record on my form based on the value I selected in my list box'
This option makes the listbox unbound and produces the following code in VBA:
***********************************************************
Private Sub ListBox_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[SiteID] = " & Str(Me![List2])
Me.Bookmark = rs.Bookmark
End Sub
***********************************************************
I've also inserted the 'Me.Form.Requery' or 'Me.[ListBox].Requery' procedure in the On Current Event of the subform.
What I am trying to accomplish is to update the subform on which the listbox resides once the user selects a record from the listbox. The fields on the subform will populate corresponding with the selected record. The code produced by the wizard is sufficient for that when viewed in the subform itself, however when I open the main form and select from the same listbox, the subform won't update. I've even tried to requery/refresh/repaint the main form but to no avail. I hope this is enough information to provide a suggestion. Thanks in advance.
TheStriker