Answered by:
Creating a subform that has navigation tabs

Question
-
Is there anyway to create a subform the utilizes navigations tabs (see preview of what I am trying to do below)? All the tabs in the subform are related to the "Record Number" on the main form. When I move to a record in the main form I want the tabs below to move to the related record for the current "record number".
Tuesday, May 15, 2012 6:09 PM
Answers
-
I think the problem derives from the use of a navigation form as a subform. Because I'm using Access 2007 I can't open your Facility Audit form, but essentially you have what I described in that the navigation form is to all intents and purposes an unbound form with subforms on a tab control. So you need to cut out the middleman.
I've added a quick and dirty form Facility Audit 1 to your file. This is a parent form based on facility Audit with a tab control, for which I've included just the first two pages, on each of which is a subform linked to the parent form on Record Number. I've posted it to my SkyDrive folder at:
https://skydrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
You might have to copy the text of the link into your browser's address bar (not the link location). For some reason it doesn't always seem to work as a hyperlink.
This should show you how to proceed. You'll need to tidy up the form and add additional pages to the tab control. You can then drag and drop the relevant subforms from the navigation pane onto the pages in form design view.A possible alternative approach which might enable you to retain your current form with the navigation form would be to base each of the forms used in the navigation form on a query which references the Record Number control of your Facility Audit form as a parameter and requery each of these forms in the Current and AfterInsert event procedures of the Facility Audit form . A conventional subform is referenced via the Form property of the subform control which contains it, but, having no experience of using navigation forms, I'm afraid I don't know exactly how you would reference a form within the tabs of a navigation form.
Ken Sheridan, Stafford, England
- Marked as answer by NCDOT Wednesday, May 16, 2012 12:46 PM
Wednesday, May 16, 2012 11:22 AM
All replies
-
Did you try Drag and Drop?
Create the subForm and close. Then create the MainForm and drag the subForm into it.
Chris Ward
Tuesday, May 15, 2012 6:49 PM -
That is how the form was created (as shown in the screen shot). It allows me to add the subform that has the navigation tabs, but does not create the link between the main form and the subform...Tuesday, May 15, 2012 8:06 PM
-
What is the Control Source of each Form? How do you join the data together in your Tables?
Chris Ward
Tuesday, May 15, 2012 8:36 PM -
I don't see any reason for the additional parent form at all here. I assume the 'subform' has separate subforms on each page of the tab control. In which case all you need to do is base the 'subform' on the facility audit table, add the Record Number, Fixed Asset Number, Visit Date and Facility Name controls to the 'subform' above the tab control, and link each of the subforms on the pages of the tab control to the parent form by setting the LinkMasterFields and LinkChildFields properties of each to [Record Number]. The 'subform' can then be opened directly and as you navigate from record to record in it each subform should show the records related to the current record in the parent form.
Ken Sheridan, Stafford, England
- Proposed as answer by KCDW Tuesday, May 15, 2012 9:31 PM
Tuesday, May 15, 2012 9:15 PM -
Of Course, thank you Ken.
Chris Ward
Tuesday, May 15, 2012 9:31 PM -
I guess let me give you some more information since what you have said doesn't make sense to me (probably my ignorance)...
What I have done up to this point is create the Facility Audit form that has the "standard" identifiers for each new audit (Record Number, Fixed Asset Number, Visit Date, and Facility Name). I then created a navigation form with tabs for each of the other "specific" audit details (Facility, Exterior-Parking, Roof-Attic, Walls-Floors, etc.). If I create a subform on the facility audit form and select the navigation form it does add it to the form as a subform but the wizard does not give me the opportunity to setup the links between the "record number" field on the main form to the "record number" field on the subform. I can not get the LinkMaster and LinkChild properties to show up to create the link after the fact.
I am not sure any of that makes sense so I have uploaded the database to SkyDrive:
https://skydrive.live.com/redir.aspx?cid=ccae0bce41149ba3&resid=CCAE0BCE41149BA3!161&parid=CCAE0BCE41149BA3!160
If you can download and open this file you will find a Facility Audit form that has the fields from the Facility Audit table as the main form fields. It then has the "Main Form" inserted as a subform. What I can't get it to do is change or populate the subform with the "record number" field.
Thanks for you help!
Tuesday, May 15, 2012 10:58 PM -
I think the problem derives from the use of a navigation form as a subform. Because I'm using Access 2007 I can't open your Facility Audit form, but essentially you have what I described in that the navigation form is to all intents and purposes an unbound form with subforms on a tab control. So you need to cut out the middleman.
I've added a quick and dirty form Facility Audit 1 to your file. This is a parent form based on facility Audit with a tab control, for which I've included just the first two pages, on each of which is a subform linked to the parent form on Record Number. I've posted it to my SkyDrive folder at:
https://skydrive.live.com/?cid=44CC60D7FEA42912&id=44CC60D7FEA42912!169
You might have to copy the text of the link into your browser's address bar (not the link location). For some reason it doesn't always seem to work as a hyperlink.
This should show you how to proceed. You'll need to tidy up the form and add additional pages to the tab control. You can then drag and drop the relevant subforms from the navigation pane onto the pages in form design view.A possible alternative approach which might enable you to retain your current form with the navigation form would be to base each of the forms used in the navigation form on a query which references the Record Number control of your Facility Audit form as a parameter and requery each of these forms in the Current and AfterInsert event procedures of the Facility Audit form . A conventional subform is referenced via the Form property of the subform control which contains it, but, having no experience of using navigation forms, I'm afraid I don't know exactly how you would reference a form within the tabs of a navigation form.
Ken Sheridan, Stafford, England
- Marked as answer by NCDOT Wednesday, May 16, 2012 12:46 PM
Wednesday, May 16, 2012 11:22 AM -
Wow Ken, that is perfect. I don't know why I didn't try to do the tab control instead of using the navigation form. I will fill in the rest of the tabs and let you know if I have any issues, but I think this will work perfectly. Thanks a million!Wednesday, May 16, 2012 12:46 PM
-
Hi NCDOT and Ken,
I'm in the EXACT same boat here. Can you explain a bit more how you've done this? I can't find Ken's helping document on his skydrive (about 20 folders). I'm happy to also search "tab control subforms" or some other key words to figure this out if you can point me in that direction. Can I salvage the work I've already done?
Apparently these navigation forms are not designed to be linked, huh?
Friday, May 18, 2012 8:54 PM -
Hello Luke,
This Forum has been answered. It is recommended if you want the best help to start a new thread for your question. This will help others know that you still have a question that needs answering. Leaving your question in an answered thread will mean it is probably over looked by the best of helpers.
Chris Ward
Friday, May 18, 2012 9:15 PM -
You start by creating a form in single form view bound to the referenced table, i.e. that on the 'one' side of the relationship, or a query on that table. Add controls bound to the relevant columns from this table at the top of a form and then add a tab control below this with the number of pages for however many subforms you want to use.
Create the forms you want to use as subforms, basing these on the referencing tables, i.e. those on the 'many' side of the relationship. These can be in single form view, continuous forms view or datasheet view. Each form's table or query must include a foreign key column which references the parent form's table's primary key column.
Add each of these forms as subforms to the parent form, one to each page of the tab control. Set the LinkMasterFields and LinkChildFields properties of each to the names of the relevant primarykey/foreign key columns. Change the Caption property of each page of the tab control to something which suitably identifies the page. If you have difficulty fitting all the tabs in with the captions as a single line you can insert carriage returns in the captions by pressing Ctrl-Enter between the words. You can also reduce the FontSize property of the tab control. You'll probably need to change the TabFixedheight property to accommodate more than one line. I find a font size of 9 points and a TabFixedHeight value of 1.2cm accommodates two lines satisfactorily.Ken Sheridan, Stafford, England
Friday, May 18, 2012 10:27 PM -
Luke:
While dealing with a question in another forum I remembered that there is a little demo file which includes the basic setup for a form with subforms on pages of a tab control as FormsDemo.zip in the SkyDrive folder to which I posted a link here earlier.
The file was originally put together to show different methods of showing data in related tables in subforms or separate 'linked' forms. I've just made a few amendments to it to include both dialogue and synchronized forms in the latter case. but the form of interest to you will be the one opened with the Tabbed Form button on the opening menu form. The tab control in this form has three pages, but only the second and third contain subforms. The first contains controls bound to the fields in the parent form's underlying table, Clients. This allows the tab control to take up more of the parent form than would be the case if space were needed for all the parent form's controls above the tab control.Ken Sheridan, Stafford, England
Saturday, May 19, 2012 5:43 PM