Problem linking sub-form to main form

GregP

Registered User.
Local time
Today, 22:19
Joined
Sep 16, 2002
Messages
66
Hi,

I've got a database I wrote a little while ago which has customer details in the main form, and details of all their orders in the sub-form. This works perfectly, and allows me to add orders into the sub-form. The two forms are linked through the customer's ID number which is included in the sub-form.

I believe the linking was done automatically through the wizard when I initially created the form.

I now have a problem in a separate database where I want to do exactly the same thing, but can't get the wizard to give me the option of a sub-form, and when I try to insert it myself, I get the following error message whenever I try to add new info to the sub-form:

"The LinkMasterFields property setting has produced this error: 'The object doesn't contain the Automation object 'tblSoftware.'"

(Both the main and subforms are fundamentally built on tblSoftware).

I've indicated which fields are common between the main form and the subform (in the wizard which appears when you create a sub-form), and the correct information is displaying in the sub-form as you cycle through the main form, so that's all good. But it won't allow me to add new entries. The last row in the sub-form allows you to type information, but doesn't automatically populate the field which links the sub-form to the main form, whereas my other database does this automatically.

Firstly, what criteria do the wizards look for in determining whether or not to offer the option of creating a sub-form? Ideally I would like to do it this way.
Secondly, if the above isn't obvious, how do I go about solving this error message?

Any help greatly appreciated!
 
Greg,

Is it possible to:

Tools --> Database Utilities --> Compact/Repair
Then ZIP
Then attach to your post.

Most likely you just have a field name wrong, but it's hard to tell
from your post.

Wayne
 
Hi Wayne,

Thanks for your response, please find the zipped database attached. The form causing the problem is called frmSoftware. If you try to type a number into the 'EENo' field in the subform, the error will be presented. I tried importing the form and subform from my other database (frmOrders), but this asks for information from the original database (I think it may be this setting I need to change, but don't think I can get 'behind the scenes' enough to change it).

Thanks in anticipation!

Greg
 

Attachments

Hey greg,

Your subform is based on a query that has SoftwareID coming
from each table. The subform doesn't know which one to
choose when you just call for SoftwareID. In the subform, take
the query's SoftwareID for its table and call it:

SubFormsID: [SoftwareID]

Then use SubFormsID when you reference that field.

Wayne
 
Hi Wayne,

I just tried that, maybe I didn't do it the right way, didn't seem to make a difference. Could you send back the one you worked on so I can see what you mean?

Ta,
Greg
 
Hi,

Just noticed Pat's reply, and yes that does seem to work, thankyou to both of you for your help.

To answer your questions Pat:

The form is intended to show pieces of software in the main part of the form and associated information, while the subform is intended to show all the actual PCs (indicated by what we call a 'EE Number', don't worry about why) which have the software installed on it (as opposed to 'people').

The two ID columns in the subform as you mentioned aren't required, I just showed them so I could see what was and wasn't working properly.

The last part of your message I think is referring to the field about the licenses? Not sure. If so, it's just to count the number of records in the subform and show this figure in the main form.


On my original enquiry, do you know what criteria Access looks for in the wizard process to determine whether to offer subforms? I even tried to recreate my 'working' subformed form and couldn't get the wizard to offer it.

Thanks again for all your help! I only do Access stuff once in a while and it takes a while to remember the tricks!

Regards,
Greg
 
Yes thanks for doing that Pat, your message was obviously posted while I was writing my reply to Wayne. Has answered my problem.
 
Pat,

I've been trying to duplicate what you did so I know for next time. You mentioned that once the duplicate fields were removed, "you were able to fix the master / child links". I've got my queries looking the same as yours, but the form still doesn't work, I still have the original problem in my database. What specifically do you mean by fixing the master/child links? Were there any other changes you had to make?

Greg
 

Users who are viewing this thread

Back
Top Bottom