473,756 Members | 1,823 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_Ite ms]![order_number]

If I have the frm_Ordered_Ite ms 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 18124
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,572 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,572 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,572 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
20803
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 site could have many units. How do I have the DLookUp field value change to a newly calcuated field when I navigate through the units? please see example below: On the Form: A site can have many units.
4
7018
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 user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
2
1720
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 populated just fine. However, when I add a new record using the new record control at the bottom of the subform, it gets added with NULL for the two values that were in the original WHERE clause. For example, if my query was "SELECT batch, style,...
2
5781
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 doing what I want it to do. What I have so far: Fields to enter search terms Subform bound to a query
1
3225
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 the subquery, which filters for a particular store. The subform is in continuous mode. So, what you see when you select a store is a list of all the items that that have not been billed for. There is a simple yes no field that filters out all...
7
3791
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 on a query. The criteria for the query is based on the user's input in the main form. One of the user inputs is a field called "Vendor_Name" (in the form of a combo box). I would like the query to run for all "Vendor_Name" if the user leaves the...
7
2012
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 subform(to frmInvoices) sfrmDetails via qryDetails. Relationship built between tblClients/tblInvoices/tblDetails by ClientID. Relationship between tblInvoices/tblDetails by InvoiceID. All works fine if
3
9683
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 names on the search form are search_title, search_author and search_isbn. The string entered in the query criteria is: Like !! This works perfectly. But now I need to take the search form and make it a subform in a form called "main". I edited...
4
2087
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 problem is that for the final user interface, I had planned to use a "frmDisplay" form which had a number of menu items and then depending on what the user selected, it would display the appropraite form in a subform beneath the menu items. I did this...
0
9456
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10040
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9873
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7248
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5142
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3806
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3359
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2666
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.