Goto Control

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
 
G

Guest

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
 
G

Guest

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
 
G

Graham R Seach

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
 
D

Dirk Goldgar

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
 
G

Guest

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
 
G

Graham R Seach

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)
 
G

Guest

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)
 

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