Expanding Find Record

John11

New member
Local time
Today, 08:16
Joined
Apr 10, 2005
Messages
9
I've just created a search button (action chosen through wizard was find record) that works fine, however I am wanting to made the button do more things.

The goal of the search button is to find a customers name. Currently to do that I have to click on the sub-form fsubListyear7, and click on the surname field then click the search button in order for the search to work properly. Is there anyway i could get the buton to do that for me.

This is currently what the button performs:
Code:
Private Sub cmdSearchy7_Click()
On Error GoTo Err_cmdSearchy7_Click


    Screen.PreviousControl.SetFocus
    DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdSearchy7_Click:
    Exit Sub

Err_cmdSearch_Click:
    MsgBox Err.Description
    Resume Exit_cmdSearchy7_Click
    
End Sub
Anyone know what i should enter for it to select Surname of fsubListyear7 before showing the 'find' window?

Thanks
 
Last edited:
Hello John11

Have you thought about using a combo box to find the surname then using combobox.value in the code for the button.
The combo box could have as its rowsource as something like "SELECT DISTINCT Surname From fsubListyear7".

Bryan
 
You could try setting the focus to the control you want and then using Docmd.findrecord - have a look in the help to see what all the arguments are.


Forms(pForm).Controls(pField).SetFocus

DoCmd.FindRecord pWhat, pSearch, pMatch, acSearchAll, pFormatted, acCurrent, pFirst


Paul
 

Users who are viewing this thread

Back
Top Bottom