Solved Combo box asking for parameters (1 Viewer)

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
I have a combo that is giving me problems and I cant seem to figure out the problem.
It is an unbound combo with a query as its row source:
1664463688670.png

When I set the criteria for ProductID to pull the ProductID from the form, it pops up the parameter window when the ID is shown in a text box and available for it to see from what I can tell.
1664463778330.png

1664463821293.png

Why is it not getting the ID from the form and asking for it instead? I havent not had this happen before without an obvious cause.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
What is the NAME of the control that has ProductID as it's source?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:22
Joined
Feb 19, 2002
Messages
43,368
Are you sure that the field is bound to a control on the form? Check the Name field of the control you think holds ProductID.
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
The field is both bound to and named ProductID but I changed it to ProductIDTxt as I hate when the wizard names things like that. Even with the change, the parameter window still pops up.
1664468915801.png
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
To try and provide a little clarification, this combo is supposed to show available product based on the ProductID the line on the continuous form has so it can be selected and then deductions run when a label is created.

Attached is what I am working on. You can get to the form in question by opening the report rptWireRoom and clicking the ticket for the first entry. the subform frmWireMulti has the combo in question that is not agreeing with me. Once I figure this out, the other subforms will have a combo just like it as well to select product that is available.
 

Attachments

  • Example.accdb
    3.6 MB · Views: 255

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
Well if it is a subform, thati is a completely different matter, as your syntax is using a mainform control?
However if I open that report, the click on 1111, the form opens fine with 18 in the Product ID?

1664470787847.png
 
Last edited:

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
Actually, now that you mention that Gas I think I have run into this problem before with trying to reference a control on a subform but for the lift of me dont remember how to do it. Will do some research real quick.
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
Bingo! Thanks for point me in the right direction Gas! :giggle:
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
OK, I see the issue, result at least.
However the combo source is fine, just refers to yet another query, so that will be where the incorrect reference is.
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
I was getting the prompt when I tried to make a selection in the combo next to the ID. What I am trying to do is let the person processing this select a reel/coil that has enough footage and cut from that then once they print the label, I will have a query run that deducts the length from the selected item.

Making the adjustment to referring to the subform then the control made it work how I was trying to get it to. The combo should be set to remember the value so I can use it for other things later.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
Well I changed the ProductID control to txtProductID. I myself prefer the txt as a prefix, easier to identify, for me at least. I also renamed the subformcontrol name, to identify it from the form name.
I then changed the criteria as per the link I gave you.

That now runs, but does not produce anything in the query, but one entry on the subform.

You can take it from there.

Code:
SELECT tblWireRoom.ProductID, tblWireRoom.CurrentLength, tblWireRoom.Hanging
FROM tblWireRoom
WHERE (((tblWireRoom.ProductID)=[Forms]![frmWireRoom]![ctrlfrmWireMulti].[Form]![txtProductID]));

1664471905350.png
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
Gas, I have run into this same problem again but this time its a subform within a subform, so 3 layers down. I am not getting an error, but it is not showing anything either.
Currently my criteria for ProductID on this one is:
[Forms]![frmWireRoom]![frmWireColors].[Form]![tblCutColorWire Subform].[Form]![ProductIDTxt]

When I enter that last .form, I dont get any autofill options for it and when I manually type [ProductIDTxt] it lets me but the results are nothing is returned.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
Look at that link and get to understand it.
It is a heirarchy. Once you understand that, then take it one level at a time.

Remember subformcontrol name NOT subform name. That is why I renamed the subform in the one I downloaded.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
I prefer not to hard code criteria using forms.
I would set a TempVar from wherever and use that as criteria.

As you are having so many problems trying to reference correctly, perhaps you should try that option?
 

tmyers

Well-known member
Local time
Today, 06:22
Joined
Sep 8, 2020
Messages
1,090
Actually I discovered that it IS working but is only getting the ProductID for the first line on the continuous form. I am going to have to read up on this more.
 

Gasman

Enthusiastic Amateur
Local time
Today, 11:22
Joined
Sep 21, 2011
Messages
14,362
Actually I discovered that it IS working but is only getting the ProductID for the first line on the continuous form. I am going to have to read up on this more.
You are only specifying one ProductID?
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 06:22
Joined
Feb 19, 2002
Messages
43,368
The tables are a hierarchy. If you want to see all the rows at the third level, you would use the PK from the second level which is the FK in the third level.
 

Users who are viewing this thread

Top Bottom