Using a Subform as Record Source Criteria

DNASok

Registered User.
Local time
Today, 15:47
Joined
Mar 1, 2012
Messages
28
I am doubtful my title properly explains what I am trying to do; I will elaborate.

I am trying to get a follow-on form to reference a subform. Here is what I currently have going:

I have two (2) tables: 00 Orders and 00 Products; both forms have primary keys "Orders ID" and "Product ID" respectively.
The "Orders ID" in "00 Orders" has a one-to-many relationship to "Orders ID" in "00 Products".
The user adds the main order details to "00 Orders" Table via "01 New Order" Form, and adds the ordered products to "00 Products" Table via a "00 Products Sub Add" Subform.
The user can then update the order via "02 Update Order" Form which has a "00 Products Sub Update" Subform.

This is working perfectly!

The "00 Products Sub Update" Subform has a "Contr Details" Button for each product ordered which opens a follow-up "00 Products Sub Update Contract Details" Form to allow the user to add additional details to the "00 Products" Table. I did this to reduce the size of the main form as the additional details are not needed to be viewed as the order process is going through the stages.

In the Record Source of this "00 Products Sub Update Contract Details" Form I have the criteria for the "Product ID" set to [Forms]![00 Products Sub Update]![Product ID]. This ensures only the additional details for the selected product come up on the form.

Everything works perfectly; I can add new orders, I can update orders, and the selected product comes up when I press the "Contr Details" Button on the "00 Products Sub Update" when it is a stand-alone Form.

What the problem is, Access asks for the user to "Enter Parameter Details" for "Forms!00 Products Sub Update!Product ID" when the "Contr Details" Button is selected in the "00 Products Sub Update" when it's a subform within the mainform.

So everything works when I use "00 Products Sub Update" as a Form by itself, but Access does not seem to be seeing the "Product ID" when "00 Products Sub Update" is a subform.
 
I believe your link is refering to if you are writting code, but I was most likely doing this incorrectly in the forms Record Source; setting the Product ID Criteria to "[Forms]![00 Products Sub Update]![Product ID]".

What should I change the "[Forms]![00 Products Sub Update]![Product ID]" to, or should I be doing this a different way?

Thank you,
 
It is irrelevant whether in code or a recordsource. You need this format from the link:

Forms!Mainform!Subform1.Form!ControlName
 
It is irrelevant whether in code or a recordsource. You need this format from the link:

Forms!Mainform!Subform1.Form!ControlName

I tried "[Forms]![02 Update Order]![00 Products Sub Update]![Product ID]", but I still get "Enter Parameter Value" for "Forms!00 Products Sub Update!Product ID"

Only difference is now I get "Enter Parameter Value" for "Forms!02 Update Order!00 Products Sub Update!Product ID" when I try to use the subform as a stand-alone form.

Thank you,
 
I tried "[Forms]![02 Update Order]![00 Products Sub Update]![Product ID]", but I still get "Enter Parameter Value" for "Forms!00 Products Sub Update!Product ID"

Only difference is now I get "Enter Parameter Value" for "Forms!02 Update Order!00 Products Sub Update!Product ID" when I try to use the subform as a stand-alone form.

Thank you,

I also just tried "[Forms]![02 Update Order]![00 Products Sub Update]![Form]![Product ID]" to no avail.
 
Can you post the db here? The syntax in post 6 looks correct, presuming those are the correct names.
 
This is a slimmed down version to fit on the upload.
 
Last edited:
How do I recreate the problem? Offhand, I don't see a control named "Product ID".
 
I guess I'm done, because that form opens without error or prompt. ;)
 
I guess I'm done, because that form opens without error or prompt. ;)

Sorry, should have been more clear on what to do to recreat.

Open "02 Update Order"
In the subform, select "Contr Details"
This will result in "Enter Parameter Details" for "Forms!00 Products Sub Update!Product ID"
 
That button attempts to open a form that doesn't exist (at least not in this sample):

02b Update Order Contract Details
 
That button attempts to open a form that doesn't exist (at least not in this sample):

02b Update Order Contract Details

Crap...I know where that came from. Where did you see that reference?
 
In the error message I get when I click on it, and in the embedded macro behind it.
 
In the error message I get when I click on it, and in the embedded macro behind it.

While looking for that 02b I believe I found the problem. I tried several things while trying to make this work. One (1) of those things was adding a "Where Condition" to the button. Once removed, this appears to be working.

Thank you very much for the assistance!

My solution to this issue was:
[Forms]![02 Update Order]![00 Products Sub Update].[Form]![Product ID]

Now to find that damn 02b!

Thank you again!!!
 

Users who are viewing this thread

Back
Top Bottom