Set Focus

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
 
A

Ashby

Instead of DoCmd.GotoControl try this:

Me!FullName.SetFocus

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

margaret

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top