By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,105 Members | 2,569 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,105 IT Pros & Developers. It's quick & easy.

Having a problem with query criteria coming from a subform

P: 9
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:

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
Share this Question
Share on Google+
6 Replies

Expert 100+
P: 489
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

Feb 20 '09 #2

P: 9
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

Expert 100+
P: 489
Glad I could help, good luck with your project.
Feb 20 '09 #4

Expert Mod 15k+
P: 31,494
Check out Referring to Items on a Sub-Form for a bit more background.

Welcome to Bytes!
Feb 22 '09 #5

P: 9
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

Expert Mod 15k+
P: 31,494
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

Post your reply

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