Move from one subform to the next subform, method?

G

Guest

Where

Main form = frmShipments
Sub1 = subTariffs
Last control on Sub1 = Value

Sub2 = subInvoices
First control on Sub2 = VendorInvNum

Sub1 and Sub2 are on separate pages of a Tab Control...

I've been trying to code the On_Exit event of Value such that focus moves to
VendorInvNum. No luck whatsoever, and I've tried many combinations from a
search in this area of the forum, as well as the How To Refer to a Control
part of mvps.org

I really need help with this, some examples use brackets, others don't, etc.
I get two hours a week to work on this db, and I've blown a month just
trying to solve this navigation problem. Somehow, a Tab Control seems to
break Access's normal tab order...
 
J

Jeff

Ricter said:
Where

Main form = frmShipments
Sub1 = subTariffs
Last control on Sub1 = Value

Sub2 = subInvoices
First control on Sub2 = VendorInvNum

Sub1 and Sub2 are on separate pages of a Tab Control...

I've been trying to code the On_Exit event of Value such that focus moves to
VendorInvNum. No luck whatsoever, and I've tried many combinations from a
search in this area of the forum, as well as the How To Refer to a Control
part of mvps.org

I really need help with this, some examples use brackets, others don't, etc.
I get two hours a week to work on this db, and I've blown a month just
trying to solve this navigation problem. Somehow, a Tab Control seems to
break Access's normal tab order...
Hi Ricter,

Put this code on the onlostfocus event of the field 'Value'

Me.sub2.SetFocus
Me.Form!sub2![VendorInvNum].SetFocus

First you have to set the focus to the subform
Then you have to identify the field on the subform and set focus to it too.

The [ ] are necessary if the name of the field has a space
e.g. [Vendor ID] or VendorID

check out the google sites for more info
http://groups.google.com.br/groups/dir?sel=33606877

Hope this helps,

jeff Cox
 
G

Guest

"Compile error:
Method or data member not found."

Jeff, that's the VB popup error I'm getting. Can't understand it, I'm using
the name of the subform as it appears in the Name field of the properties
sheet.



Jeff said:
Ricter said:
Where

Main form = frmShipments
Sub1 = subTariffs
Last control on Sub1 = Value

Sub2 = subInvoices
First control on Sub2 = VendorInvNum

Sub1 and Sub2 are on separate pages of a Tab Control...

I've been trying to code the On_Exit event of Value such that focus moves to
VendorInvNum. No luck whatsoever, and I've tried many combinations from a
search in this area of the forum, as well as the How To Refer to a Control
part of mvps.org

I really need help with this, some examples use brackets, others don't, etc.
I get two hours a week to work on this db, and I've blown a month just
trying to solve this navigation problem. Somehow, a Tab Control seems to
break Access's normal tab order...
Hi Ricter,

Put this code on the onlostfocus event of the field 'Value'

Me.sub2.SetFocus
Me.Form!sub2![VendorInvNum].SetFocus

First you have to set the focus to the subform
Then you have to identify the field on the subform and set focus to it too.

The [ ] are necessary if the name of the field has a space
e.g. [Vendor ID] or VendorID

check out the google sites for more info
http://groups.google.com.br/groups/dir?sel=33606877

Hope this helps,

jeff Cox
 
G

Guest

Hi, Ricter.
I've been trying to code the On_Exit event of Value such that focus moves to
VendorInvNum.

The syntax is not intuitive. Assuming subInvoices is the name of the second
subform control (not Sub2), place the following code in the module of the
form used in the subTariffs subform control:

Private Sub Value_LostFocus()

On Error GoTo ErrHandler

Me.Parent!subInvoices.SetFocus
Me.Parent!subInvoices.Controls!VendorInvNum.SetFocus

Exit Sub

ErrHandler:
MsgBox "Error in Value_LostFocus( ) in" & vbCrLf & _
Me.Name & " form." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear

End Sub

Save and compile the code.
I really need help with this, some examples use brackets, others don't, etc.

Brackets are used to enclose identifiers with illegal characters or Reserved
words, such as the word "Value," to fix problems that will otherwise occur
when the Jet expression service tries to read them. Sometimes brackets fail
to fix the problem or even cause new problems, so they should never be used
by someone who doesn't have time to chase bugs. Avoid Reserved words and
only use alphanumeric characters and the underscore character for your
identifiers, and you won't waste time chasing bugs when the Jet expression
service misuses them. For lists of Reserved words to avoid, please see the
following Web pages:

http://support.microsoft.com/default.aspx?id=321266

http://support.microsoft.com/default.aspx?scid=286335

When reading this second page, pay particular attention to the myth on that
page because if you believe it, you will waste a lot of time chasing very
hard to find bugs that will teach you why it's not always true:

"For existing objects with names that contain reserved words, you can avoid
errors by surrounding the object name with brackets ([ ])."
I get two hours a week to work on this db, and I've blown a month just
trying to solve this navigation problem.

Be prepared to spend some of your own time to learn Access if you want to
become proficient with it.
Somehow, a Tab Control seems to
break Access's normal tab order...

Subform controls on tab controls seem to cause people problems -- and extra
work to manage them properly. Back in the days when people were using 15-
and 17-inch monitors where screen real estate was at a premium, tab controls
sure came in handy. These days with larger monitors and much higher
resolutions, much of the time when a tab control is necessary it's because
there are way too many controls or too much wasted space on the form. If
this application isn't being used on laptops, then consider whether a form
redesign would help make your life easier.

HTH.
Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips and tutorials.
http://www.Access.QBuilt.com/html/expert_contributors2.html for contact info.

- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.
 

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