Help with SearchForRecord

csuebele

New member
Local time
Today, 05:39
Joined
Jul 6, 2011
Messages
8
I've got a form that list photo jobs that were shot. I have a button to click on this form that will open a detailed form, but using SeachForRecord does not work and go to the record on that form. Here's my code (the message box is just to make sure the variable has the right log number I want to go to - testing only):

Code:
Function GoToMainEntry()
    
    Dim RecLog As String
    RecLog = Forms![frm_ListView]![LogNumber]
    DoCmd.OpenForm "frm_MainEntry", acNormal, "", "", , acNormal
    DoCmd.SearchForRecord acForm, "frm_MainEntry", acLast, "[LogNumber] = " & RecLog
    MsgBox (RecLog)
End Function

What am I doing wrong?
 
I just tried findRecord, and that seems to do what I want. Still trying to figure out what to use when and why that command.
 
In you statement where you are using the "SearchForRecord" method, try changing the "acLast" to "acFirst" and see if that helps. This is the parameter of the method that tell it where to start looking for the record you are searching for. If you are telling it to start at the last record, I is just not finding the record. According to the help file, this method does not "wrap" when it reached the end of the data.
 

Users who are viewing this thread

Back
Top Bottom