Calling a subform from a menu bar

DeeDee77

Registered User.
Local time
Today, 16:12
Joined
Jan 24, 2002
Messages
21
I have a form(frmMaintenance) that is called from the menu bar that contains a subform(department). The subform should change according to which menu item is chosen (Dept., Location, etc.) and this is the code that I have in the module being called for location:

Public Function Open_Loc()
DoCmd.OpenForm "frmMaintenance"
Forms!frmMaintenance!department!department_subform_Label.Caption = "Location"
Forms!frmMaintenance!department!department_subform.SourceObject = "location"
End Function

It gives an error saying that the field department cannot be found. Thanks for any help!!
 
That is the correct syntax, so your problem is that the subform you created on teh main form is not called department. Check the properties of the subform (the one on that you created on the main form) and change the name of it to department.
 

Users who are viewing this thread

Back
Top Bottom