I have a `Mainform` with `textbox` and `button` to search `subform` record
it works fine when i directly open `Mainform` and searching desire record
but when i open my form in `Navigaition` form it gives me error.
[Download My Access Project] What i have tried.
Below is my code:
Code:
Private Sub cmdSearch_Click()
Dim MainFK As Long
MainFK = DLookup("MainformID", "Subform", "SubformID =" & Me.txtSearch)
DoCmd.SearchForRecord acDataForm, "Mainform", acFirst, "MainformID=" & MainFK
End Sub
Below is screen shot
Please guide me.