Subform tabing - ahhhhhgh

  • Thread starter Thread starter adam.sherratt
  • Start date Start date
A

adam.sherratt

Dear all,

After spending a fair bit of time searching the forums, I have finally
given in. I have a form that contains 3 subforms. The subforms are
all based on queries. The subforms contain a set of combo boxes
(basically used to asign a value of Pass/Fail). I can tab out of the
1st subform to the main and back into the second form no problem.

' set focus to main form
Me.Parent.Form.SetFocus


' then to the subform *control* on the main form
Forms![frmLVQAUpdate]!sfrmLVQAResultsDataIntegrity.SetFocus


' and finally to the field in the subform
Me!Pass.SetFocus


The problem is that I can no longer tab within the subforms. I think
this is because they are based on queries i.e. in desing mode there is
one set of combo boxes, but when viewed after running the query there
are 3 boxes to update. (it basically creates a table where a value is
true, and creates the combo box accordingly, so from design mode there
is 1 box, but in view mode there could be many)

Before I used this code I could tab within each subform, from combo to
combo no problem. now, I can tab from subform 1 to subform 2, but when
I press tab, it doesn't tab from control 1 to control 2, it jumps to
subform3.

Any suggestions? Its a bit hard to explain my setup, because of the
nature of the subforms/queries.

Thanks
 
After spending a fair bit of time searching the forums, I have finally
given in. I have a form that contains 3 subforms. The subforms are
all based on queries. The subforms contain a set of combo boxes
(basically used to asign a value of Pass/Fail). I can tab out of the
1st subform to the main and back into the second form no problem.

' set focus to main form
Me.Parent.Form.SetFocus


' then to the subform *control* on the main form
Forms![frmLVQAUpdate]!sfrmLVQAResultsDataIntegrity.SetFocus


' and finally to the field in the subform
Me!Pass.SetFocus


The problem is that I can no longer tab within the subforms. I think
this is because they are based on queries i.e. in desing mode there is
one set of combo boxes, but when viewed after running the query there
are 3 boxes to update. (it basically creates a table where a value is
true, and creates the combo box accordingly, so from design mode there
is 1 box, but in view mode there could be many)

Before I used this code I could tab within each subform, from combo to
combo no problem. now, I can tab from subform 1 to subform 2, but when
I press tab, it doesn't tab from control 1 to control 2, it jumps to
subform3.


This has nothing to do with the queries. I suspect that hte
issue is caused by where you placed the code.

The general approach for this situation is to add a tiny
textbox to each subform and place it after the last control
in each subform's tab order. Then use code in its GotFocus
event:
Me.Parent.sfrmLVQAResultsDataIntegrity.SetFocus
Me!Pass.SetFocus
 
Thanks for your reply

yep, thats what I have done. The tab order of the form is as follows;

cmbPass - tab stop yes
txtFaultNO - tab stop no
txtDataset - tab stop no
txtFaultDescription - tab stop no
txtTabHere <--------this is the tab "sentry".

As you can see, cmbPass exists only once on the subform, until the
query is run. The query looks for all items with a certain fault
number, and lists them in the form. On the form this gives us multiple
instances of cmbPass. N.B without this code, the tab works correctly
within the subform, allowing me to tab down the list of cmbPass.

Any suggestions for an alternative approach for this?
 
Nmidia said:
yep, thats what I have done. The tab order of the form is as follows;

cmbPass - tab stop yes
txtFaultNO - tab stop no
txtDataset - tab stop no
txtFaultDescription - tab stop no
txtTabHere <--------this is the tab "sentry".

As you can see, cmbPass exists only once on the subform, until the
query is run. The query looks for all items with a certain fault
number, and lists them in the form. On the form this gives us multiple
instances of cmbPass. N.B without this code, the tab works correctly
within the subform, allowing me to tab down the list of cmbPass.


Are you trying to tell me that the subforms are in
Continuous view and that you want to tab from record to
record until you get to the last record when tab is supposed
to jump to somwhere else?

If that's the case, then the "sentry" text box has to figure
out what it supposed to do in these two situations. I may
not have all the names straight, but here's the general idea
of how I think it might be done:

Private Sub txtTabHere_GotFocus()
With Me.RecordsetClone
.MoveLast
If Me.CurrentRecord = .RecordCount Then
Me.Parent.sfrmLVQAResultsDataIntegrity.SetFocus
Me.Pass.SetFocus
Else
Me.cmbPass .SetFocus
.Bookmark = Me.Bookmark
.MoveNext
Me.Bookmark = .Bookmark
End If
End With
End Sub
 
Back
Top