Tabbed Navigation - Referring to form on a tab (1 Viewer)

lloydteacher

New member
Local time
Yesterday, 20:35
Joined
Sep 14, 2018
Messages
3
I created an Access 365 Navigation Form and put my Students form on the first tab. The Students form has a subform called Attendance. Now my VBA code in the OnChange event of a combo on the subform can't find the frmStudents.
It, of course is now on a tab. These tabs run horizontally across the top.
Any ideas on how to refer to my frmStudents in the VBA code now?
Thanks. :)
 

AccessBlaster

Registered User.
Local time
Yesterday, 20:35
Joined
May 22, 2010
Messages
5,917
Make sure your form / subform and combo box are working correctly before dropping anything on the navigation tab.

If you have not done that, go back and make sure all the controls are working and all the vba for the form / subform is working before moving them as one unit to the navigation tab.

To be clear the "navigation control-form" is where you drop a completed form / subform. If you try to build on this control from scratch you will have to manually connect everything. This control is designed to be a drag and drop hybrid switchboard of sorts.

BTW, I personally love them. I used to hate all that layout crap but not any more.

HTH
 

lloydteacher

New member
Local time
Yesterday, 20:35
Joined
Sep 14, 2018
Messages
3
My frmStudents has a subform Attendance that has a combo box on it. The combo box has an onChange event which refers to frmStudents (the Main form). This was working until I created a Navigation Form in Access 365 by doing Create > Navigation > Horizontal Tabs. Now that my frmStudents is on a tab on the Navigation Form, using the combo box and changing it's value - the VBA gives me an error that it can't find the frmStudents. Maybe there is also adding a reference to the tab? Someone said [Parent]!
 

lloydteacher

New member
Local time
Yesterday, 20:35
Joined
Sep 14, 2018
Messages
3
Ok. My form and subform were working correctly. I've tested a lot. It's when I dragged my frmStudents, which has a subform frmAttendance that my VBA caused an error:
Error 2450 TestVersion2 cannot find the referenced form 'frmStudents',) in procedure
AttendanceCode_Change
So now that my frm Students is on a tab on the Navigation Form, VBA can't find it. It needs some kind of added reference. Thanks.
 

Pat Hartman

Super Moderator
Staff member
Local time
Yesterday, 23:35
Joined
Feb 19, 2002
Messages
43,223
When you place a form on another form, you must add that form to the reference hierarchy.

Forms!originalForm!subform!.Form!somecontrol

Beomes:

Forms!navigationform!originalform!subform.Form!somecontrol

Also, keep in mind that with the navigation form only a single form is ever loaded at one time so you can never reference formA from formB. If you need to do this, you cannot use the navigation form. You need to build your own navigation form - which is actually pretty easy.
 

AccessBlaster

Registered User.
Local time
Yesterday, 20:35
Joined
May 22, 2010
Messages
5,917
For thoses who are familiar with this type of form here is a link demonstrating a navigation form.
 

AccessBlaster

Registered User.
Local time
Yesterday, 20:35
Joined
May 22, 2010
Messages
5,917
Ok. My form and subform were working correctly. I've tested a lot. It's when I dragged my frmStudents, which has a subform frmAttendance that my VBA caused an error:
Error 2450 TestVersion2 cannot find the referenced form 'frmStudents',) in procedure
AttendanceCode_Change
So now that my frm Students is on a tab on the Navigation Form, VBA can't find it. It needs some kind of added reference. Thanks.


lloydteacher: Can you upload a copy of your DB with dummy information. If you have trouble uploading try zipping it first.
 

Users who are viewing this thread

Top Bottom