can't find subform

lipin

Registered User.
Local time
Today, 01:16
Joined
May 21, 2002
Messages
149
I have a main form with a subform on it. There is a command button on main form that opens a third form that when it opens, contains data from textboxes on both the main and subform and has a few new ones for added data.

Problem is when I click command button I get errror 'can't find subform'. I have checked the subform name over and over. Even tried changing it. No good.

Here's the code I am trying in 3rd form's OnOpen:
Private Sub Form_Load()

txtAuditor = [Forms]![AUDIT WITH MULTIPLE ERRORS]![Auditor Number]

txtDate = [Forms]![AUDIT WITH MULTIPLE ERRORS]![Date]

txtEmpl = [Forms]![EmplErrorsSubform]![Employee]

End Sub

Keep getting error on the txtEmpl line.
Thanks.
 
Firstly to find the correct name of the subform, go into design view in the main form, now right click on the subform, select properties and the correct name for the subform should be in the blue part of the properties window, or under the "Other" tab. The point is the name of the subform to use isn't the name of the source object but the name as given in the properties window.

The name you will use for the main form is whatever you have saved it as lets say: AUDIT WITH MULTIPLE ERRORS

The name for the subform will be as I have outlined above, lets say: EmployeeSub

Now suppose a control on this subform is Employee. To reference this control:

Forms![AUDIT WITH MULTIPLE ERRORS]![EmployeesSub]![Employee]

This syntax for referencing a subform is a shortened version and will work fine, I believe the strict syntax is:

Forms![AUDIT WITH MULTIPLE ERRORS]![EmployeesSub].Form![Employee]

However you shouldn't have to worry about this

Liam
 

Users who are viewing this thread

Back
Top Bottom