Tab thru Form, Subform fields

G

Guest

The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)
 
G

Guest

Thanks for replying!

I'll give the method you specified a try. I'll let you know.

As you make no reference to the code being incorrect, should I assume that
it is correct, as far as you can see?
--
2nd_Stage_User


Rli said:
The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

2nd_Stage_User said:
The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


Rli said:
The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

2nd_Stage_User said:
The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

I am puzzled also...
Your code seems ok to me....there seems to be some mix up..
are you sure each pageID on each subform has its own on_exit procedure?..
(since you are using the same last fieldname for each subform...).
The 'tab order' you are mentionning....on the main form...it should not
mention all the individual fields of each subform also, only the name of the
subform.
Did you check all the 'auto-stop', 'tab stop' and 'Tab Index' properties of
the fields?

2nd_Stage_User said:
I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


Rli said:
The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

2nd_Stage_User said:
The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

Thank you for this reply (and, thanks for giving this latest post a look)!

Yes, each PageID of each Subform has its own On Exit procedure.

Yes, the Main Form Tab order lists only its own fields, and only the
Subforms. The Subform fields are not listed on the Main Form Tab Order.

I don't know anything about "'auto-stop', 'tab stop' and 'Tab Index'
properties of
the fields." What should properties be?

Regarding the code, I'll list it now. (After Code, I'll list Form, Subform,
and relevant Field Names. After Names, I'll list exactly how Tab behaves.)

BEGIN CODE ...

1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub

2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub

3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub

4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub

END CODE ...

BEGIN Main Form, Subform, and Relevant Field Names ...

1.) Main Form = BM_DataEntry ... first field = PageID ... last field = Link
2.) 1st Subform = Details_Subform ... first field = DetailID ... last field
=
PageID
3.) 2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last
field
= PageID
4.) 3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID

END Names ...

BEGIN Tab Behavior ...

Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.

Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.

Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.

END Tab Behavior ...

--
2nd_Stage_User


Rli said:
I am puzzled also...
Your code seems ok to me....there seems to be some mix up..
are you sure each pageID on each subform has its own on_exit procedure?..
(since you are using the same last fieldname for each subform...).
The 'tab order' you are mentionning....on the main form...it should not
mention all the individual fields of each subform also, only the name of the
subform.
Did you check all the 'auto-stop', 'tab stop' and 'Tab Index' properties of
the fields?

2nd_Stage_User said:
I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


Rli said:
The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

:

The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

Each field has its own 'auto-stop', 'tab stop' properties, just activate a
field in one of the subforms for instance and ask for its
properties....(right mouse button) and see the 'other' tab on the properties
dialog.
'Tab stop' should be set to Yes (otherwise it will not go there with a
tab-click)
and
'Auto tab' should be set to No (otherwise it will not use your tab order
reflected in 'tab index')


Your code still seems ok to me....you could enter a temporary messagebox to
make sure you are executing the right part of the code at the right moment
like this:

Private Sub Link_Exit(Cancel As Integer)
MsgBox "Executing on_exit on LINK field. Going to DetailID",
vbInformation, "setfocus-Check"
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub

such a line in each ON_EXIT procedure could help to find the problem
2nd_Stage_User said:
Thank you for this reply (and, thanks for giving this latest post a look)!

Yes, each PageID of each Subform has its own On Exit procedure.

Yes, the Main Form Tab order lists only its own fields, and only the
Subforms. The Subform fields are not listed on the Main Form Tab Order.

I don't know anything about "'auto-stop', 'tab stop' and 'Tab Index'
properties of
the fields." What should properties be?

Regarding the code, I'll list it now. (After Code, I'll list Form, Subform,
and relevant Field Names. After Names, I'll list exactly how Tab behaves.)

BEGIN CODE ...

1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub

2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub

3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub

4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub

END CODE ...

BEGIN Main Form, Subform, and Relevant Field Names ...

1.) Main Form = BM_DataEntry ... first field = PageID ... last field = Link
2.) 1st Subform = Details_Subform ... first field = DetailID ... last field
=
PageID
3.) 2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last
field
= PageID
4.) 3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID

END Names ...

BEGIN Tab Behavior ...

Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.

Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.

Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.

END Tab Behavior ...

--
2nd_Stage_User


Rli said:
I am puzzled also...
Your code seems ok to me....there seems to be some mix up..
are you sure each pageID on each subform has its own on_exit procedure?..
(since you are using the same last fieldname for each subform...).
The 'tab order' you are mentionning....on the main form...it should not
mention all the individual fields of each subform also, only the name of the
subform.
Did you check all the 'auto-stop', 'tab stop' and 'Tab Index' properties of
the fields?

2nd_Stage_User said:
I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


:

The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

:

The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

now i come to think of it...
aren't you using nested subforms?
Is SubjectHead_subform a subform in Details_subform wich is a subform in
BM_DataEntry?
If this is the case you should refer to the DetailID field field like this:

Forms![BM_DataEntry]![Details_Subform].Form![SubjectHead_subform].Form![DetailID].setfocus

you can introduce an error capture with error-message in your ON_EXIT subs
to see if there are any structural statement errors

2nd_Stage_User said:
Thank you for this reply (and, thanks for giving this latest post a look)!

Yes, each PageID of each Subform has its own On Exit procedure.

Yes, the Main Form Tab order lists only its own fields, and only the
Subforms. The Subform fields are not listed on the Main Form Tab Order.

I don't know anything about "'auto-stop', 'tab stop' and 'Tab Index'
properties of
the fields." What should properties be?

Regarding the code, I'll list it now. (After Code, I'll list Form, Subform,
and relevant Field Names. After Names, I'll list exactly how Tab behaves.)

BEGIN CODE ...

1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub

2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub

3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub

4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub

END CODE ...

BEGIN Main Form, Subform, and Relevant Field Names ...

1.) Main Form = BM_DataEntry ... first field = PageID ... last field = Link
2.) 1st Subform = Details_Subform ... first field = DetailID ... last field
=
PageID
3.) 2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last
field
= PageID
4.) 3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID

END Names ...

BEGIN Tab Behavior ...

Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.

Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.

Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.

END Tab Behavior ...

--
2nd_Stage_User


Rli said:
I am puzzled also...
Your code seems ok to me....there seems to be some mix up..
are you sure each pageID on each subform has its own on_exit procedure?..
(since you are using the same last fieldname for each subform...).
The 'tab order' you are mentionning....on the main form...it should not
mention all the individual fields of each subform also, only the name of the
subform.
Did you check all the 'auto-stop', 'tab stop' and 'Tab Index' properties of
the fields?

2nd_Stage_User said:
I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


:

The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

:

The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

No, I'm not using nested Subforms. Each Subform is a Subform of BM_Details,
only.

I had hoped that you would answer my question about "'auto-stop', 'tab stop'
and 'Tab Index' properties of the fields," and what properties they should be.
That area seems like the most likely area for source of problems, if the
code I supplied you in my latest post looks good.

If you can help with the "'auto-stop', 'tab stop' and 'Tab Index' info, this
might help (unless you see/think something else).

--
2nd_Stage_User


Rli said:
now i come to think of it...
aren't you using nested subforms?
Is SubjectHead_subform a subform in Details_subform wich is a subform in
BM_DataEntry?
If this is the case you should refer to the DetailID field field like this:

Forms![BM_DataEntry]![Details_Subform].Form![SubjectHead_subform].Form![DetailID].setfocus

you can introduce an error capture with error-message in your ON_EXIT subs
to see if there are any structural statement errors

2nd_Stage_User said:
Thank you for this reply (and, thanks for giving this latest post a look)!

Yes, each PageID of each Subform has its own On Exit procedure.

Yes, the Main Form Tab order lists only its own fields, and only the
Subforms. The Subform fields are not listed on the Main Form Tab Order.

I don't know anything about "'auto-stop', 'tab stop' and 'Tab Index'
properties of
the fields." What should properties be?

Regarding the code, I'll list it now. (After Code, I'll list Form, Subform,
and relevant Field Names. After Names, I'll list exactly how Tab behaves.)

BEGIN CODE ...

1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
End Sub

2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
End Sub

3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
End Sub

4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub

END CODE ...

BEGIN Main Form, Subform, and Relevant Field Names ...

1.) Main Form = BM_DataEntry ... first field = PageID ... last field = Link
2.) 1st Subform = Details_Subform ... first field = DetailID ... last field
=
PageID
3.) 2nd Subform = SubjectHead_Subform ... first field = SubjectID ... last
field
= PageID
4.) 3rd Subform = Author_Subform ... first field = AuthorID ... last field =
PageID

END Names ...

BEGIN Tab Behavior ...

Problem #1 ... When I attempt to Tab from "last field" in 1st Subform to
"first field" in 2nd Subform, the cursor does "not" move to 2nd Subform.
Instead, it moves back to "first field" of 1st Subform.

Problem #2 ... When I attempt to Tab from "last field" in 2nd Subform to
"first field" in 3rd Subform, the cursor does "not" move to 3rd Subform.
Instead, it moves back to "first field" of 2nd Subform.

Exception to Problems ... When I Tab from "last field" in Main Form to
"first field" in 1st Subform, the Tab works. Likewise, when I Tab from "last
field" in 3rd Subform to "first field" in Main Form, the Tab works.

END Tab Behavior ...

--
2nd_Stage_User


Rli said:
I am puzzled also...
Your code seems ok to me....there seems to be some mix up..
are you sure each pageID on each subform has its own on_exit procedure?..
(since you are using the same last fieldname for each subform...).
The 'tab order' you are mentionning....on the main form...it should not
mention all the individual fields of each subform also, only the name of the
subform.
Did you check all the 'auto-stop', 'tab stop' and 'Tab Index' properties of
the fields?

:

I gave your instructions a try.

Now, I don't get an "error" when Tabbing from "last field" of BM_DataEntry
to "first field" of Details_Subform.

However, I can not Tab from "last field" of Details_Subform to "first field"
of SubjectHead_Subform.

Also, if I "mouse" to fields of SubjectHead_Subform, and then attempt to Tab
from "last field" of SubjectHead_Subform to "first field" of Author_Subform,
the cursor does not leave SubjectHead_Subform. It just recirculates thru
fileds of SubjectHead_Subform.

Additionally, if I "mouse" to fields of Author_Subform, and then attempt to
Tab from "last field" of Author_Subform to "first field" of BM_DataEntry, the
Tabbing works.

For Tab Order, there are 4 sets of Tab Orde:

1.) Tab Order for BM_DataEntry includes fields of BM_DataEntry, then
Details_Subform, SubjectHead_Subform, Author_Subform

2.) Tab Order for Details_Subform includes only fields of Details_Subform

3.) Tab Order for SubjectHead_Subform includes only fields of
SubjectHead_Subform

4.) Tab Order for Author_Subform includes only fields of Author_Subform
--
2nd_Stage_User


:

The lines on your code should not be split over to lines...?(no carriage
return in the middle of the setfocus statement)

:

The code lines given to me by someone trying to help do "not" work. Can
anybody see what's wrong with the code?

The code is for moving the cursor, via Tab key, thru all fields of a Form.

Before presenting code lines, I'll present pertinent design elements just
for reference, when reading the "bad" code.

01.) "Form" consists of a main form, with 3 subforms within the main form
02.) Main form is called BM_DataEntry
03.) 1st subform is called Details_Subform
04.) 2nd subform is called SubjectHead_Subform
05.) 3rd subform is called Author_Subform
06.) BM_DataEntry uses fields from Main table
07.) Details_Subform uses fields from Details table
08.) SubjectHead_Subform uses fields from Subject table
09.) Author_Subform uses fields from Author table
10.) Primary key in Main table is foreign key in each of the other three
tables
11.) Primary key is "PageID"
12.) Last field in BM_DataEntry is "Link"
13.) First field in Details_Subform is "DetailID"
14.) Last field in Details_Subform is "PageID"
15.) First field in SubjectHead_Subform is "SubjectID"
16.) Last field in SubjectHead_Subform is "PageID"
17.) First field in Author_Subform is "AuthorID"
18.) Last field in Author_Subform is "PageID"
19.) First field in BM_DataEntry is "PageID"

Below is the code. It is in 4 pieces. It is written for the "On Exit"
property of the "last field" of BM_DataEntry, Details_Subform,
SubjectHead_Subform, and Author_Subform, respectively.

Private Sub Link_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Details_Subform].Form!
[DetailID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![SubjectHead_Subform].Form!
[SubjectID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![Author_Subform].Form!
[AuthorID].SetFocus
End Sub

Private Sub PageID_Exit(Cancel As Integer)
Forms![BM_DataEntry]![PageID].SetFocus
End Sub
 
G

Guest

Hi...
look at one of my previous awnsers..i did explain the maining of those
properties.
Just build in the proposed message box and error capture and you will
certainly find the problem.
 
G

Guest

"maining" ???

"Just build in the proposed message box and error capture and you will
certainly find the problem." ???

"you can introduce an error capture with error-message in your ON_EXIT subs
to see if there are any structural statement errors" ???

.... Unfortunately, I don't know enough to understand what you're talking
about, and I do not know what to do. Thanks anyhow. Your time and attention
has been appreciated ...
 
G

Guest

Well, you did not / cannot read previous messages?
I give it a last try:
Each field has its own 'auto-stop', 'tab stop' properties, just activate a
field in one of the subforms for instance and ask for its
properties....(right mouse button) and see the 'other' tab on the properties
dialog.
'Tab stop' should be set to Yes (otherwise it will not go there with a
tab-click)
and
'Auto tab' should be set to No (otherwise it will not use your tab order
reflected in 'tab index')
You could modify your source code this way to find the error (with
messageboxes to indicate 'where' you are and with error trapping:
1.) Code for Tab from "last field" in Main Form to "first field" in 1st
Subform:

Private Sub Link_Exit(Cancel As Integer)
On Error GoTo Err_Link_Exit
MsgBox "Executing on_exit on LINK field. Going to
DetailID",vbInformation,"setfocus-Check"
Forms![BM_DataEntry]![Details_Subform].Form![DetailID].SetFocus
Exit_PageID_exit:
Exit Sub
Err_Link_exit:
MsgBox Err.Description
Resume Exit_Link_exit
End Sub

2.) Code for Tab from "last field" in 1st Subform to "first field" in 2nd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
On Error GoTo Err_PageID_Exit
MsgBox "Executing on_exit on PageID in Details_Subform. Going to
SubjectID",vbInformation,"setfocus-Check"
Forms![BM_DataEntry]![SubjectHead_Subform].Form![SubjectID].SetFocus
Exit_PageID_exit:
Exit Sub
Err_PageID_exit:
MsgBox Err.Description
Resume Exit_PageID_exit
End Sub

3.) Code for Tab from "last field" in 2nd Subform to "first field" in 3rd
Subform:

Private Sub PageID_Exit(Cancel As Integer)
On Error GoTo Err_PageID_Exit
MsgBox "Executing on_exit on PageID in SubjectHEad_subform. Going to
AuthorID",vbInformation,"setfocus-Check"
Forms![BM_DataEntry]![Author_Subform].Form![AuthorID].SetFocus
Exit_PageID_exit:
Exit Sub
Err_PageID_exit:
MsgBox Err.Description
Resume Exit_PageID_exit
End Sub

4.) Code for Tab from "last field" in 3rd Subform to "first field" in Main
Subform:

Private Sub PageID_Exit(Cancel As Integer)
On Error GoTo Err_PageID_Exit
MsgBox "Executing on_exit on PageID in Author_subform. Going to PageID in
BM_DataEntry",vbInformation,"setfocus-Check"
Forms![BM_DataEntry]![PageID].SetFocus
Exit_PageID_exit:
Exit Sub
Err_PageID_exit:
MsgBox Err.Description
Resume Exit_PageID_exit
End Sub
 

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