SetFocus Problems

C

Coach K

I am using Access 03 i have a form with a cmd button on that once it is click
bring up the find dialog box. I am trying to set focus on field call
"PONumber", but i keep getting "Object doesn't support this propertly or
method"

Here is the code:

Private Sub cmdFindPO_Click()
'Set focus on the PO number field
On Error GoTo Err_cmdFindPO_Click

Me![PONumber].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFindPO_Click:
Exit Sub

Err_cmdFindPO_Click:
MsgBox Err.Description
Resume Exit_cmdFindPO_Click

End Sub

Thanks for your value help!
 
J

Jack Leach

You need to set the focus to a control, not the field. For instance, if the
control name for the field PONumber is ctlPONumber, then you would use:

Me.ctlPONumber.SetFocus

Fields are not capable of receiving focus, as they are underlying form.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)
 
C

Coach K

Jack, Thanks all this time I was looking at the control source name. I was
getting the ID10T error.
Again, thanks alot!!
--
Coach K
"Knowledge is Power"


Jack Leach said:
You need to set the focus to a control, not the field. For instance, if the
control name for the field PONumber is ctlPONumber, then you would use:

Me.ctlPONumber.SetFocus

Fields are not capable of receiving focus, as they are underlying form.

hth
--
Jack Leach
www.tristatemachine.com

"I haven''t failed, I''ve found ten thousand ways that don''t work."
-Thomas Edison (1847-1931)



Coach K said:
I am using Access 03 i have a form with a cmd button on that once it is click
bring up the find dialog box. I am trying to set focus on field call
"PONumber", but i keep getting "Object doesn't support this propertly or
method"

Here is the code:

Private Sub cmdFindPO_Click()
'Set focus on the PO number field
On Error GoTo Err_cmdFindPO_Click

Me![PONumber].SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_cmdFindPO_Click:
Exit Sub

Err_cmdFindPO_Click:
MsgBox Err.Description
Resume Exit_cmdFindPO_Click

End Sub

Thanks for your value help!
 

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