Set Focus

  • Thread starter Thread starter margaret
  • Start date Start date
M

margaret

In my "Add New Record" event procedure I have added the
GoToControl line to have the new record go to FullName
control. However, when I try it, it tells me it can't
find the form "FRM_Cash_On_Hand". Is there something
wrong with the code below???

Private Sub NewRecord_Click()

On Error GoTo Err_NewRecord_Click

DoCmd.GoToRecord , , acNewRec
DoCmd.GoToControl (Forms!FRM_Cash_On_Hand!
FullName.SetFocus)


Exit_NewRecord_Click:
Exit Sub

Err_NewRecord_Click:
MsgBox Err.Description
Resume Exit_NewRecord_Click

End Sub
 
Instead of DoCmd.GotoControl try this:

Me!FullName.SetFocus

The "ME" is a shorthand way of referring to the form you
are on.
 
That worked like a champ ... thanks so much.

-----Original Message-----
Instead of DoCmd.GotoControl try this:

Me!FullName.SetFocus

The "ME" is a shorthand way of referring to the form you
are on.
 
Back
Top