Order in which required fields are entered into a form

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

Guest

Hi,

I have created a form with 3 subforms. This form is split in to 3 parts on a
3-page tab control.

I want the user to enter data in the order below. All fields are required.
My problem is that Access97 wants all fields of the main form to be completed
in the order set by the table. I have tried setting the form tab order
property but it is being overridden.

First page:
a) Complete first 6 fields of main form
b) Complete subform 1
c) Complete subform 2
Second page:
d) Complete 5th field of main form
e) Complete subform 3
f) Complete 6th field of main form
Third page
g) Complete three fields of main form

Any help appreciated,
Seth
 
Seth,

I have never experienced the Tab Order settings for a form being
overridden. But the settings apply to the controls within each form
separately. You are jumping back and forth between the main form and
the subforms. I think you will need to use code to control the
navigation around your form. I am a bit confused by your description...
it looks like the 5th and 6th "fields" on the main form get entered
twice? But anyway, for example, it looks like you could put something
like this on the Exit event of the last control on subfrom 2:
Me.Parent![NameOf_5thMainControl].SetFocus
Similar code could be used to direct the cursor in cases where the Tab
Order is not applicable.
 
Thanks alot Steve.
I can see how it is possible to do it with setfocus. I have now used
setfocus to successfully jump between controls on the main form but am having
trouble with the syntax for jumping from the main form to a subform. I have
never used VB code before so I might be missing something quite basic. Here
is my attempt:

Me!sfrmTestReportStds.SetFocus

Me.Parent! will get me from a subform to the main form but I am trying to go
from the main form to a subform.

Regards,
Seth

In my frist email '5th' and '6th' should read '7th' and '8th'

Steve Schapel said:
Seth,

I have never experienced the Tab Order settings for a form being
overridden. But the settings apply to the controls within each form
separately. You are jumping back and forth between the main form and
the subforms. I think you will need to use code to control the
navigation around your form. I am a bit confused by your description...
it looks like the 5th and 6th "fields" on the main form get entered
twice? But anyway, for example, it looks like you could put something
like this on the Exit event of the last control on subfrom 2:
Me.Parent![NameOf_5thMainControl].SetFocus
Similar code could be used to direct the cursor in cases where the Tab
Order is not applicable.

--
Steve Schapel, Microsoft Access MVP

Hi,

I have created a form with 3 subforms. This form is split in to 3 parts on a
3-page tab control.

I want the user to enter data in the order below. All fields are required.
My problem is that Access97 wants all fields of the main form to be completed
in the order set by the table. I have tried setting the form tab order
property but it is being overridden.

First page:
a) Complete first 6 fields of main form
b) Complete subform 1
c) Complete subform 2
Second page:
d) Complete 5th field of main form
e) Complete subform 3
f) Complete 6th field of main form
Third page
g) Complete three fields of main form

Any help appreciated,
Seth
 
Seth,

Looks like what you have is right, assuming that sfrmTestReportStds is
the name of the subform control on the main form, and that the code is
being called form an event on the main form. However, if you want to
move from a control on the main form to a control on the subform (and
the control on the subform is not the first control in the subform's Tab
Order), you need to do it in two steps. First step like you've got it,
and then the next step like this...
Me!sfrmTestReportStds.Form!NameOfControlOnSubform.SetFocus
 
Hi Steve

With the suggested code in the OnExit property the get the following error:

Run-time error '2110': Microsoft Access can't move the focus to the control
sfrmTestReportStds.

When I remove the suggested code I get this message:

! The field 'tblTestReports.TestReportRating' can't contaian a Null value
because the Required property for this field is set to True. Enter a valuse
in this field.

I want to fill in sfrmTestReportStds before I fill in
'tblTestReports.TestReportRating'. tblTestReports is the main form.

I've spent hours trying to work this out and I'm not sure what's going on.
Do I have to fill in all required fields on the main form before I fill in
the subforms?

Regards,
Seth
 
Seth,
Do I have to fill in all required fields on the main form before I fill in
the subforms?

Yes. As soon as you move the focus from the main form, Access needs to
save the record, so if you have fields whose Required property is set to
Yes, then they have to have data in them.
 
Thanks Steve. Everything makes sence now.
Seth

Steve Schapel said:
Seth,


Yes. As soon as you move the focus from the main form, Access needs to
save the record, so if you have fields whose Required property is set to
Yes, then they have to have data in them.
 
There is a great table by Keri Hardwick to show how to reference forms,
subforms, and sub-subforms from various locations (including subform to main
form). I keep a copy on my computer as I use it often.

It can be found at : http://www.mvps.org/access/forms/frm0031.htm

Seth said:
Thanks alot Steve.
I can see how it is possible to do it with setfocus. I have now used
setfocus to successfully jump between controls on the main form but am having
trouble with the syntax for jumping from the main form to a subform. I have
never used VB code before so I might be missing something quite basic. Here
is my attempt:

Me!sfrmTestReportStds.SetFocus

Me.Parent! will get me from a subform to the main form but I am trying to go
from the main form to a subform.

Regards,
Seth

In my frist email '5th' and '6th' should read '7th' and '8th'

Steve Schapel said:
Seth,

I have never experienced the Tab Order settings for a form being
overridden. But the settings apply to the controls within each form
separately. You are jumping back and forth between the main form and
the subforms. I think you will need to use code to control the
navigation around your form. I am a bit confused by your description...
it looks like the 5th and 6th "fields" on the main form get entered
twice? But anyway, for example, it looks like you could put something
like this on the Exit event of the last control on subfrom 2:
Me.Parent![NameOf_5thMainControl].SetFocus
Similar code could be used to direct the cursor in cases where the Tab
Order is not applicable.

--
Steve Schapel, Microsoft Access MVP

Hi,

I have created a form with 3 subforms. This form is split in to 3 parts on a
3-page tab control.

I want the user to enter data in the order below. All fields are required.
My problem is that Access97 wants all fields of the main form to be completed
in the order set by the table. I have tried setting the form tab order
property but it is being overridden.

First page:
a) Complete first 6 fields of main form
b) Complete subform 1
c) Complete subform 2
Second page:
d) Complete 5th field of main form
e) Complete subform 3
f) Complete 6th field of main form
Third page
g) Complete three fields of main form

Any help appreciated,
Seth
 
Back
Top