Goto Control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form: Orders by Customer
and a subform: Orders by Customer Subform

Upon opening the form I have the user select a "Customer" and then all
Orders for that customer is displayed. Simple enough.

What I want to do is: AfterUpdate put the user in a field "OrderID" on the
Orders by Customer Subform.

I tried: DoCmd.GoToControl (Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID])

But that's not right...What am I doing wrong?!!!! Please help

Thanks, in advance
 
Hi, Stephen.

First move to the subform control, then to the subform's control.

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer Subform]

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]

Hope that helps.
Sprinks
 
That gave ma a runtime Error 2498
The Expression you entered is the wrong data type for one of the arguments.

Any other suggestions?! Thanks

Sprinks said:
Hi, Stephen.

First move to the subform control, then to the subform's control.

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer Subform]

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]

Hope that helps.
Sprinks
Stephen said:
I have a form: Orders by Customer
and a subform: Orders by Customer Subform

Upon opening the form I have the user select a "Customer" and then all
Orders for that customer is displayed. Simple enough.

What I want to do is: AfterUpdate put the user in a field "OrderID" on the
Orders by Customer Subform.

I tried: DoCmd.GoToControl (Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID])

But that's not right...What am I doing wrong?!!!! Please help

Thanks, in advance
 
Close:

Forms![Orders by Customer]![Orders by Customer Subform].Form.SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Sprinks said:
Hi, Stephen.

First move to the subform control, then to the subform's control.

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer Subform]

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]

Hope that helps.
Sprinks
Stephen said:
I have a form: Orders by Customer
and a subform: Orders by Customer Subform

Upon opening the form I have the user select a "Customer" and then all
Orders for that customer is displayed. Simple enough.

What I want to do is: AfterUpdate put the user in a field "OrderID" on
the
Orders by Customer Subform.

I tried: DoCmd.GoToControl (Forms![Orders by Customer]![Orders by
Customer
Subform].Form![OrderID])

But that's not right...What am I doing wrong?!!!! Please help

Thanks, in advance
 
Graham R Seach said:
Close:

Forms![Orders by Customer]![Orders by Customer Subform].Form.SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

Graham, does it work with that ".Form" qualifier in the the first
SetFocus? I'm too lazy to check right now, but I'm quite sure that it's
not necessary, and that it would work as just:

Forms![Orders by Customer]![Orders by Customer Subform].SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus
 
Sorry, Stephen, for the bum steer. I had the same problem long ago, and was
focused on the issue of moving to the subform control first that I didn't
examine the method!

Glad you got it resolved.
Sprinks

Stephen said:
That gave ma a runtime Error 2498
The Expression you entered is the wrong data type for one of the arguments.

Any other suggestions?! Thanks

Sprinks said:
Hi, Stephen.

First move to the subform control, then to the subform's control.

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer Subform]

DoCmd.GoToControl Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID]

Hope that helps.
Sprinks
Stephen said:
I have a form: Orders by Customer
and a subform: Orders by Customer Subform

Upon opening the form I have the user select a "Customer" and then all
Orders for that customer is displayed. Simple enough.

What I want to do is: AfterUpdate put the user in a field "OrderID" on the
Orders by Customer Subform.

I tried: DoCmd.GoToControl (Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID])

But that's not right...What am I doing wrong?!!!! Please help

Thanks, in advance
 
Yes, you're right Dirk. I was too lazy to double-check.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Dirk Goldgar said:
Graham R Seach said:
Close:

Forms![Orders by Customer]![Orders by Customer Subform].Form.SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

Graham, does it work with that ".Form" qualifier in the the first
SetFocus? I'm too lazy to check right now, but I'm quite sure that it's
not necessary, and that it would work as just:

Forms![Orders by Customer]![Orders by Customer Subform].SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Thanks to All...works like a charm
(Simple when it's explained to you)
Stephen

Graham R Seach said:
Yes, you're right Dirk. I was too lazy to double-check.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Dirk Goldgar said:
Graham R Seach said:
Close:

Forms![Orders by Customer]![Orders by Customer Subform].Form.SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

Graham, does it work with that ".Form" qualifier in the the first
SetFocus? I'm too lazy to check right now, but I'm quite sure that it's
not necessary, and that it would work as just:

Forms![Orders by Customer]![Orders by Customer Subform].SetFocus

Forms![Orders by Customer]![Orders by Customer
Subform].Form![OrderID].SetFocus

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 
Back
Top