Error in code for an edit button

SD23

Registered User.
Local time
Today, 11:03
Joined
Jun 13, 2006
Messages
60
I am trying to execute this code. I have a edit form and when I click edit, it should open up the form "Input Form." It should open the specific form based on what the user enters for "name." I get an error (RunTime 2137) saying "You cant use Find or Replace Now." I am not quite sure why this error is happening. It highlights the line with the **. Any ideas on how I could fix this. Thanks for your help.

Private Sub edit_Click()

DoCmd.OpenForm "Input Form", acNormal, "", "", , acNormal

DoCmd.GoToControl "Name"

**DoCmd.FindRecord Forms![Search]![nam]**

End Sub
 
Not sure if this is what you need, but this will filter for records that match "name"

Code:
Private Sub edit_Click()
On Error Goto Err_edit_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Input Form"
    stLinkCriteria = "[name] = '" & Me.name & "'"

    DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_edit_Click:
    Exit Sub

Err_edit_Click:
    MsgBox Err.Description
    Resume Exit_edit_Click

End Sub

Hope this helps?
 

Users who are viewing this thread

Back
Top Bottom