I'm curious why DoCmd.OpenForm ... isn't sufficient?
Here's some code that you can try. Put this in a new module:
Code:
'modified from david fenton's code posted here:' https://stackoverflow.com/questions/3401645/how-do-i-bring-up-a-record-based-on-a-combobox-in-access
Public Sub OpenForm(ByVal form_name As String, ByVal where_condition As String)
On Error GoTo ErrHandler
Dim my_form As Form
DoCmd.OpenForm form_name
Set my_form = Forms(form_name)
my_form.FilterOn = False
With my_form.RecordsetClone
.FindFirst where_condition
If Not .NoMatch Then
If my_form.Dirty Then my_form.Dirty = False
my_form.Bookmark = .Bookmark
Else
' put your not found code here
End If
End With
ExitHandler:
Set my_form = Nothing
Exit Sub
ErrHandler:
MsgBox Err.Description, , "Error #" & Err.Number
Resume ExitHandler
End Sub
Then call it from your list box's dbl click event with something like this:
Code:
OpenForm "frmPerson", "[PersonID]=" & Me![LstPersonSearch].Column(0)