473,505 Members | 15,036 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Having a problem with query criteria coming from a subform

ajhayes
9 New Member
Hello everyone,

This is my first time posting here and I'm hoping someone can help me out. I'm a relative newbie to Access and am pretty much learning as I go along, so please bear with me.

Here is what I am trying to do. I'm building a simple database that will allow our engineering staff to enter in the items from the inventory warehouse that will be required for a project. Each inventory item has a unique part number, which is entered by the user.

I have a query set up that pulls all of the required information together, and then there is a report based on this query.

What I am ultimately trying to do is have a command button at the end of the order form that allows the user to print the order based on the current order number in the form.

I have set up the query criteria using:
[forms]![frm_Ordered_Items]![order_number]

If I have the frm_Ordered_Items open by itself, and put a command button at the bottom to open the report based on the query using this criteria, it works perfectly.

The problem is that I've set up the form as a sub-form, and once it's nested into the other form, a popup button comes up and calls for the query parameter to be entered manually. How can I change this so that it will perform the query and bring up the report automatically?

I hope I've given enough information to explain the situtation clearly.
Feb 20 '09 #1
9 18077
DonRayner
489 Recognized Expert Contributor
If you are trying to refer to a subform, you must first refer to the control on the main form that contains it. Then you can refer to the controls on the subform.

Expand|Select|Wrap|Line Numbers
  1. Forms!MainForm!frm_Ordered_Items.Form!order_number
Just replace MainForm with whatever the name is of your main form.

Welcome to Bytes

Don
Feb 20 '09 #2
ajhayes
9 New Member
Okay, I just cheered out loud in the middle of my super quiet office... everyone is wondering what the heck I'm up to now. :-)

That was exactly the fix. I've googled it a billion times and couldn't find the right syntax.

Thank you SO much!!
Feb 20 '09 #3
DonRayner
489 Recognized Expert Contributor
Glad I could help, good luck with your project.
Feb 20 '09 #4
NeoPa
32,557 Recognized Expert Moderator MVP
Check out Referring to Items on a Sub-Form for a bit more background.

Welcome to Bytes!
Feb 22 '09 #5
ajhayes
9 New Member
Thanks for that link, that will be a big help in the future.

Printing that out for my stash of references.
Feb 23 '09 #6
NeoPa
32,557 Recognized Expert Moderator MVP
You're welcome AJ.

Do you realise we also have a whole forum (Access Insights) just for such articles. To a large extent they are responses to Frequently Asked Questions. Issues that come up over and over again. There's other stuff there too, but it's where we put the answers we need to link to most.
Feb 23 '09 #7
rufinojr54
2 New Member
Hi!

I think, I have the same problem but still wasn't able to fix it. Mine is 2 combo boxes, the 2nd combo box is based on a query, getting values related to the 1st combo box. It is working perfectly when not as a subform. But, when I make it as a subform, a parameter value is asked. How do I fix it? And, in ExpenseDetail table, I put, ExpenseID, which is a primary key in ExpenseT, also a table. Will I only be able to generate ExpenseIDs if I can fix my problem above? Please help!


Thanks,
Apr 20 '22 #8
rufinojr54
2 New Member
This worked for me now. Just changed the name of the subform then followed your syntax. 👏👏👏👍🙏
Apr 20 '22 #9
NeoPa
32,557 Recognized Expert Moderator MVP
Please understand that we don't encourage extra questions to be posted into existing threads. That would get very messy very quickly.

Nevertheless, in this case, as you have already posted that you've got the answer from here, we'll treat it just like a simple Thank you. post which are allowed of course.
Apr 21 '22 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
20743
by: KLAU | last post by:
I have a field that retrieves information from an expression in a query. I have used a DLookup function to get the calculated field from the query. However, the relationship is 1-to-many so one...
4
6968
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the...
2
1710
by: JM | last post by:
Hello, I've created a Querydef in a Form_Load() sub. The form is a subform that no longer has linked child fields. The form is bound to this querydef. When I open the form, the fields are...
2
5761
by: Smartin | last post by:
Using Access 97 I am trying to create a form that allows for user entry of search terms and displays a table of results. I thought I could accomplish this using a subform but it isn't quite...
1
3200
by: bcreighton | last post by:
I have created a bound subform on an unbound masterform linked together with a common field (A store's identification number) using an unbound combobox on the masterform and an invisible field on...
7
3768
by: keliie | last post by:
Hello Just a quick question that I've spent a few hours trying to solve with no luck (although one would think this should be fairly easy). I have a form with a subform. The subform is based...
7
1981
by: Ron | last post by:
Hi All, Using Access2000, winXP. Table 1 = tblClients displayed on frmClients via qryClients. 2nd table = tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails shown on...
3
9645
by: stevecat | last post by:
Hi there, I have created a form, "search" and a query "search_product". The query returns the product information based upon the criteria for three of the fields, author, title or isbn. The field...
4
2071
by: Regnab | last post by:
I've got a form - "frmLookup" (with a subform) that works very happily on its own. The form has a list box, which when updated requeries the subform to display the appropriate results. The...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7303
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7367
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
754
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.