Finding a Record in MS Access (RESOLVED)
In MS Access, how do I find a record using VBA?
I've used the following code to attempt to find the value "1011" in the field "Mold Tag" in the form "Mold Master", but it doesn't work.
VB Code:
Public Sub findit()
Dim txName As String
txName = "1011"
Forms![Mold Master].FindRecord "[Mold Tag]=" & txName
End Sub
I get run-time error 2465 - "Application-defined or object-defined error".
Re: Finding a Record in MS Access
I never used your way, but try adding single quotes around txName.
Re: Finding a Record in MS Access
Its not the correct syntax. Try something like this.
VB Code:
DoCmd.FindRecord txName, acEntire, False, acSearchAll, True, acAll, True