Form working properly alone, but gives error when combined with other forms

connerlowen

Registered User.
Local time
Today, 11:37
Joined
May 18, 2015
Messages
204
HI,

I have a form "NewMetalF" that has three combo boxes. The first one is used to choose "Precious Metal" or "Base Metal". The second one shows all the metals based on the first combo box. When I open the form in form view alone the combo boxes work flawlessly. I run the form "NewMetalF" within another form "NewExternalPartF" by clicking a button "AddMetal". When the button is clicked "NewMetalF" opens. The first combo box is selected, and when the second combo box is clicked the error "Enter Paramater Value" "Forms!NewMetalF!cboPreciousOrBase". I do not understand why this error is only happening some of the time. Please help me understand why this happening, and how to fix it.

Thanks,

Conner Owen
 
Is that reference pointing to the right form and combo box and is the form open?
 
Yes. Its open within another form.
NewMetalsF screenshot.PNG
NewEnternalPartF before button click.PNG
error.PNG
After click.PNG
 
It is a subform in a way, I want it to open on the click command. But I don't know that there is really a lick between the fields. This is the relationship between the two tables.

relationship.PNG
 
I don't need to see the relationships. It's either a subform or it isn't, so please explain what you mean by "in a way" or better still upload a screenshot of the whole form in design view.
 
forms.PNG This is a screenshot of the form NewMetalF with in form NewExternalPartF within form NewQuotationPartF. There are internal and external parts. The NewQuotationPartF has a combo box for external or Internal, which determines which form becomes visible. Then within NewExternalPartF the NewMetal button can be clicked to add data to NewMetalF.
 
It's a subform, and like I already mentioned you need to reference the subform accordingly. Use the link you were given earlier.
 
I have changed the needed information within the query of the combobox in the subform for it to work. I will have many forms that use this subform, does this mean I need to just leave it as a regular form because there is no way to have a subform referenced in many forms? It works in one of my forms, but not in the other.

Thanks,

Conner
 
It works on one form because it's not a subform there or you have referenced it correctly. There's a need to reference a subform control. If you want to use the same query on multiple subforms then you'll need to duplicate the query and reference the right form>subform.

This is how you reference a subform:
Code:
Forms!ParentForm!SubformControlName!FieldOrControlName
Remember that the subform is a control, just like a textbox. If you wanted to get the value of a textbox you would use it's name. A subform is basically a form embedded in a subform control so in order to reference what's in the subform, you first need to reference its control.

In design view, click the subform once - now that's the subform control
Click it again, and you will be in the form within it.

Makes sense?
 
Yes it does. I think I am going to make it just another form that opens up as a pop up with the click of that button.
 
Whichever way you choose, just make sure it's intuitive. My advice is, don't create a pop up form just because you don't want to create a duplicate of a query.
 
So I only need to duplicate the queries and just give them different names and I can only have one form used as a subform in many different forms?
 
No. Please read my explanation of subform controls and referencing again, and go back to that link and re-read what's there, over again. Take your time to digest the information.

The reference must reflect the parent form and the subform control names.
 

Users who are viewing this thread

Back
Top Bottom