How do I set focus to an item in a list identified from another form?

M

M Skabialka

I have a form in Access 2003 with ten tabs, each with the same subform
listing parts based on the tab name. The number of items is still expanding
so now it is hard to find the item needed. I created a pop-up seach form to
help users find what tab name and what system the item is under, but that
still narrows it down to 20 or 30 items. They would like to be able to
select the item on the search form, close it, and find the correct tab open
and the item they chose selected in the list.
The tabs are named forms!frmParts!TabName - I am not sure how to set the
focus to a particular one, e.g. Engine, Electrical, Misc, or how, once I've
identified the part, to go to it on the subform. I can get the PartID from
the search from, but how do I set focus to it in the continuous forms
subform on the correct tab?

Thanks,
Mich
 
M

M Skabialka

Rather than having a form listing 500+ parts, I devided them into major
groups (tabs) and systems (Engine, Electrical, Misc, etc). Only one
tab/subform is open at a time. After selecting a part they then open other
forms and perform functions related to that part. The form works very well
in its current design, and a combo box would not work at all.

I need to know how to open a tab on this form, and set focus to the part on
the subform, based on a selection on a search form.
I have tried forms!frmParts!TabName.Pages("Misc").SetFocus and variations
without success.
 
M

M Skabialka

I found out that if I set the TabName, e.g.
forms!frmParts!TabName = 4
the focus will go to the correct Tab.
How do I then set focus on the record with the correct ID?

bhicks11 via AccessMonster.com said:
Use 2 lines:

First set focus to the subform (Tab), then the control.

Me!subform.SetFocus
me!subform.control.setfocus

Bonnie
http://www.dataplus-svc.com

M said:
Rather than having a form listing 500+ parts, I devided them into major
groups (tabs) and systems (Engine, Electrical, Misc, etc). Only one
tab/subform is open at a time. After selecting a part they then open
other
forms and perform functions related to that part. The form works very
well
in its current design, and a combo box would not work at all.

I need to know how to open a tab on this form, and set focus to the part
on
the subform, based on a selection on a search form.
I have tried forms!frmParts!TabName.Pages("Misc").SetFocus and variations
without success.
If you know which form or subform you use this syntax:
[quoted text clipped - 29 lines]
Thanks,
Mich
 
M

M Skabialka

Managed to find the answer - this is all done from the search
form"frmQuickFindParts":

Forms!frmParts!SelectedPartID = PartID
Forms!frmParts!SelectedPartName = PartName

' Find the record that matches the control.
Dim rs As Object

Select Case TabName
Case "Electrical" 'and others using similar code but different
subform and TabName numbers
Forms!frmParts!TabName = 5
Set rs = [Forms]![frmParts]![frmParts
subform6].Form.Recordset.Clone
rs.FindFirst "[PartID] = " & Forms!frmParts![SelectedPartID]
If Not rs.EOF Then [Forms]![frmParts]![frmParts
subform6].Form.Bookmark = rs.Bookmark
End Select

DoCmd.Close acForm, "frmQuickFindParts"

It opens the correct tab and sets focus to the correct record. - Now if I
could figure a way to highlight that record - that would be awesome!
Mich

M Skabialka said:
I found out that if I set the TabName, e.g.
forms!frmParts!TabName = 4
the focus will go to the correct Tab.
How do I then set focus on the record with the correct ID?

bhicks11 via AccessMonster.com said:
Use 2 lines:

First set focus to the subform (Tab), then the control.

Me!subform.SetFocus
me!subform.control.setfocus

Bonnie
http://www.dataplus-svc.com

M said:
Rather than having a form listing 500+ parts, I devided them into major
groups (tabs) and systems (Engine, Electrical, Misc, etc). Only one
tab/subform is open at a time. After selecting a part they then open
other
forms and perform functions related to that part. The form works very
well
in its current design, and a combo box would not work at all.

I need to know how to open a tab on this form, and set focus to the part
on
the subform, based on a selection on a search form.
I have tried forms!frmParts!TabName.Pages("Misc").SetFocus and variations
without success.

If you know which form or subform you use this syntax:

[quoted text clipped - 29 lines]
Thanks,
Mich
 

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