Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

From subform to orignal form

Status
Not open for further replies.

hrg

Programmer
Jan 8, 2009
46
US
I posted this yesterday

Hi

I have a database where i have a form and a sub form within it. It works by the user entering data in the form. The subform is activated by changing data in the last field in the FORM (onChange Enable subform). When i have finished entering data into the sub form i have a button which when i click it is supposed to go back to the first text field on the FORM. I have tried using the gotocontrol method but do not know if it is the right one to use.

The code.

DoCmd.GoToControl TxtBatchNo (also have tried using brackets)
SUBFORMNAME.Enabled = False

The error that comes up is "The action or method requires a Control Name argument"

So to sum up.

What i want (if anybody could help) is when clicking the button it disables the SUBFORM and goes back to the first text field.

Thank for the help.

So this is what i tryed after someone told me to do this

Forms!YourMainFormName!YourControlName.SetFocus

so i did this

frmsubfriendorder!frmorder!TxtBatchNo.SetFocus

but now it comes up with an object error does anybody know how to do this another way.
 
You left off Forms!

Forms!frmsubfriendorder!frmorder!TxtBatchNo.SetFocus

also, is frmsubfriendorder a subform of frmorder? If so, you only need the following:

Forms!frmorder!TxtBatchNo.SetFocus



 
I think your syntax is wrong

frmsubfriendorder!frmorder!TxtBatchNo.SetFocus


Is the frmsubfriendorder the Main or Sub form?

Try:

Forms!frmOrder!txtBatchNo.SetFocus
^
|
Main Form
Then,
forms!frmOrder.Controls("frmsubfriendorder").enable = false

That should work.

Let me know.

Bob


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top