add a GoToControl Action

mag

Registered User.
Local time
Today, 21:36
Joined
Jul 31, 2003
Messages
19
Hello sometimes when Find Record Button on my form generates an error..that says among other things to
"Add a GoToControl action before the FindRecord Action."

I know zilch VBA...could some tell me the syntax for adding this line and where I should add it.
exisiting code for the button is below:thankyou


Private Sub Command22_Click()
On Error GoTo Err_Command22_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Exit_Command22_Click:
Exit Sub
 
Are you doing a search record button? If yes then i think this will help

code:
_________________________________________________
Private Sub Command0_Click()
On Error GoTo Err_Command0_Click


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

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click

End Sub
_________________________________________________
 
Do Menu Item has been obsolete for several years now, it's better to use the RunCommand instead
DoCmd RunCommand acCmdSaveRecord
DoCmd RunCommand acCmdFind
 
gratzi

thnx for the input that works well now.
 

Users who are viewing this thread

Back
Top Bottom