Exit continuous view subform

G

Guest

I'd like to know if there is a current preferred practice for making movement
between continuous view subforms behave the same as it does for moving
between datasheet view subforms, ie. when in the last field of the subform
the user pressing Tab or Enter moves the focus to the next control in the tab
order.

I've googled the problem and found, imho, a rather convoluted solution.
Thought I'd check for something simpler in later Access versions.

tia
 
G

Guest

I cannot get out of the subform without using Ctl + Tab. Even using the
following code, I remain "stuck" in the first subform:

Private Sub Value_Exit(Cancel As Integer)

Forms![frmShipments]![subInvoices].Form![VendorInvNum].SetFocus

End Sub

That's Microsoft's syntax. And I've used the examples from the Access Web
"How to refer to controls and properties", etc. I don't understand the
problem here.

Mainform: frmShipments
sub1: subTariffs
sub2: subInvoices
Last field in subTariffs: Value
First field in subInvoices: VendorInvNum
 
J

John Vinson

I cannot get out of the subform without using Ctl + Tab. Even using the
following code, I remain "stuck" in the first subform:

Private Sub Value_Exit(Cancel As Integer)

Forms![frmShipments]![subInvoices].Form![VendorInvNum].SetFocus

In my experience you need TWO setfocus events: first setfocus to the
other subform, and only after that setfocus to a control in that form:

Forms![frmShipments]![subInvoices].SetFocus
Forms![frmShipments]![subInvoices].Form![VendorInvNum].SetFocus

or if frmShipments is the parent form, just use

Parent!subInvoices.SetFocus
Parent![subInvoices].Form![VendorInvNum].SetFocus

John W. Vinson[MVP]
 
G

Guest

Bingo! Thanks John.

And now I can go back and try to solve an old problem, moving from a subform
I cannot get out of the subform without using Ctl + Tab. Even using the
following code, I remain "stuck" in the first subform:

Private Sub Value_Exit(Cancel As Integer)

Forms![frmShipments]![subInvoices].Form![VendorInvNum].SetFocus

In my experience you need TWO setfocus events: first setfocus to the
other subform, and only after that setfocus to a control in that form:

Forms![frmShipments]![subInvoices].SetFocus
Forms![frmShipments]![subInvoices].Form![VendorInvNum].SetFocus

or if frmShipments is the parent form, just use

Parent!subInvoices.SetFocus
Parent![subInvoices].Form![VendorInvNum].SetFocus

John W. Vinson[MVP]
 
J

John Vinson

Bingo! Thanks John.

And now I can go back and try to solve an old problem, moving from a subform
on a tab control to a subform on another tab. I have a feeling that two set
focus events might just solve it.

They should. Note that the tab control plays NO role - you simply set
focus to the subform then the control on the subform, you don't need
to reference the tab page or the tab control at all (the right page
will open).

John W. Vinson[MVP]
 

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