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

Error - Creating Report from combo-box on Form

P: 2
Hi, need some help please! Here is a quick description of what I'm trying to achieve:

I have an Access 2010 database where I can produce a Report based on my various "products".

It currently lists all products and the relevant info to that product I have added. I have also created a Form with a drop down box of all my "products".

What I want to do is, click on a button next to the drop down box in my Form and select this "product" only to show in my Report. I have used the following to do this:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Report_Click()
  2.  
  3. DoCmd.OpenReport "xxTotSum", acViewPreview, , "[Article No#]=" & Me![ArticleNoBox], acWindowClose
  4.  
  5. End Sub
However, when I then try to 'click' my button, I only get the "Enter Parameter Value" box. I hate this box! Any ideas of what I need to do? Important note, my VBA and Access knowledge is very small - currently learning by doing!

Attached Images
File Type: jpg Error.jpg (49.4 KB, 2490 views)
Nov 1 '11 #1
Share this Question
Share on Google+
5 Replies


Seth Schrock
Expert 2.5K+
P: 2,951
Don't forget to use the mandatory code tags around your code.

What I usually do in this situation is to base the report off of a query and the query has the criteria for the ProductID based on the combo box selection. You would then use the after update event of the combo box to open the report like this:

Expand|Select|Wrap|Line Numbers
  1. DoCmd.OpenReport "xxTotSum", acViewPreview
This should give the results that you are looking for.

If you need help with the query, just let me know. I'll need to know the field names to be included in the report.
Nov 1 '11 #2

P: 2
Hi Seth

Thanks for the response. I've got my code like you've suggested, by I still get the "Enter Parameter Value" box.

I think the query and report are correct because these already work. All I want to do is rather than have a report which lists all of my "Products", I want to select one from the drop box on my Form and then press the button to select and produce the Report.

Do you think my query is maybe wrong then?!
Nov 1 '11 #3

Seth Schrock
Expert 2.5K+
P: 2,951
That would seem to be the only option left. If you could post the SQL code for your query and the name of the combo box and form it is on, I'll check it out.
Nov 1 '11 #4

NeoPa
Expert Mod 15k+
P: 31,709
MiniMike:
However, when I then try to 'click' my button, I only get the "Enter Parameter Value" box
The prompt in the box would be more helpful than the title that's common to all such prompts.

This generally indicates you've mis-spelled or mistyped something. What that is we can't know without your telling us the contents of the box.

You can find more on your general task at Example Filtering on a Form.
Nov 2 '11 #5

NeoPa
Expert Mod 15k+
P: 31,709
MiniMike:
Do you think my query is maybe wrong then?!
After what you've posted in #3 then Yes. That's very likely.

We would still benefit from knowing the exact contents of the prompt box though.
Nov 2 '11 #6

Post your reply

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