B
Bryan Hughes
Hello,
I have a form with a listbox that I would like the sub form to move to the
selected record with a click event for the list.
I have not been able to make it work.
It goes to the first record in the link field of the recordset not to the
exact record.
Here is my code:
Private Sub lstContacts_Click()
On Error GoTo ErrorHandler
Dim strSQL As String
Dim lngCACLID As Long
Me.fsubContact_Details.SourceObject = "fsubContact_Details"
Me.fsubContact_Details.Visible = True
lngCACLID = "[CACLID] = " & Me.lstContacts.Column(0)
Me.fsubContact_Details.Form.Requery
Me.fsubContact_Details.Form.RecordsetClone.FindFirst lngCACLID
Me.fsubContact_Details.Form.Bookmark =
Me.fsubContact_Details.Form.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
Err.Clear
Resume ErrorHandlerExit
End Sub
What is wrong with the code?
How can I make this work?
-Bryan
I have a form with a listbox that I would like the sub form to move to the
selected record with a click event for the list.
I have not been able to make it work.
It goes to the first record in the link field of the recordset not to the
exact record.
Here is my code:
Private Sub lstContacts_Click()
On Error GoTo ErrorHandler
Dim strSQL As String
Dim lngCACLID As Long
Me.fsubContact_Details.SourceObject = "fsubContact_Details"
Me.fsubContact_Details.Visible = True
lngCACLID = "[CACLID] = " & Me.lstContacts.Column(0)
Me.fsubContact_Details.Form.Requery
Me.fsubContact_Details.Form.RecordsetClone.FindFirst lngCACLID
Me.fsubContact_Details.Form.Bookmark =
Me.fsubContact_Details.Form.RecordsetClone.Bookmark
ErrorHandlerExit:
Exit Sub
ErrorHandler:
Err.Clear
Resume ErrorHandlerExit
End Sub
What is wrong with the code?
How can I make this work?
-Bryan