Question find record on another form

Core

Registered User.
Local time
Today, 07:23
Joined
May 27, 2008
Messages
79
I have one form that has a listbox showing the results of a filter, which works fine.

The list box has a doubleclick event that I want to open a form and then find a record on the form. I tried to following but it does not work. Any advice?

With Forms!frmEmployerView.RecordsetClone
.FindFirst "ID = " & Me.lstView
If .NoMatch Then
MsgBox "not found"
Else
Me.Bookmark = .Bookmark
End If
End With

The code works with me.recordsetclone, so i presume I am not referring to the form correctly. I cannot find the help required from google.
 
Core, do you want it to open the form and goto that record or do you want it to be filtered out?
 
Just go to it, I still want them to be able to use the navigation controls.
 
Here's what you would use:
Code:
    Dim rst As DAO.Recordset

    DoCmd.OpenForm "frmEmployerView"
    
    Set rst = Forms("frmEmployerView").RecordsetClone
    
    With rst
        .FindFirst "ID = " & Me.lstView
        
        If Not .NoMatch Then
            Forms("frmEmployerView").Bookmark = .Bookmark
        End If
    End With
    
    Set rst = Nothing

Ensure that Me.lstView is actually returning the right number.
 

Users who are viewing this thread

Back
Top Bottom