Using a form to enter criteria for a query

Gemma the Form with the combo does not have to be linked to anything.

Brian
 
If you create a form with fields/comboboxes/listboxes for the criteria and create public variables and public functions to read them, you could code a button to load the info from the controls into the variables and set the criteria for the query equal to the functions.
 
Brianwarnock said:
Gemma the Form with the combo does not have to be linked to anything.

Brian
OK I'll try it again...perhaps it's because I'm such a novice when it comes to reading some of the instructions here

such as:
Before running the report, make sure the VendorForms form is already open and a vendor name in the combo box has been selected.
I am unclear with this instruction. I opened the vendorForms, and then I highlighted the vendor that I wanted...I go to the reports, still it's not doing anything.

It's better to run the report from a command button on the form. In the On Click event of the command button, you can use the OpenReport method like this:-

DoCmd.OpenReport "your report name", acViewPreview

This instruction is more advanced than my skill at this point, where should I paste this command? Should I paste it in the SQL view or something?


I think as of right now might as well I start over again with a simpler database and pray that hopefully I can figure this out......
 
Sometimes when you cant get it, as the saying goes "a picture paints a thousand words. Hope you can make something of this..

Put together with suggestions from the previous posts, this is a version I think of what you want.
lightray
 

Attachments

  • scrdmp-8.gif
    scrdmp-8.gif
    32 KB · Views: 174
Hi Lightray, yes that is pretty much what I wanted...just to replace from data entry to a pull down list. Still not clear on where I should do the docommand thing though.

I just want to say I feel so dumb...as you guys can see my Access knowledge is really really basic...simple stuff that perhaps I 'should know already' obviously I have no clue. Hope you guys can be patient with me.:(

I tried following the instruction that I got from another thread:

http://www.fontstuff.com/access/acctut08.htm#dialog

I am still stuck with the same pop up dialog (please see attached)

What's frustrating for me is I know this is supposed to be very easy solution and I know everybody is trying to help also, but I am just not getting it....perhaps I need a step to step instruction or somebody to take a look at what I did wrong? My database isn't that big, if somebody would be able to look at it, I'd appreciate it!

Please PM me if you'd like to help out.

Thanks again guys!
 

Attachments

AccessNewbie72, your screenshot image suggests that the form is not open before the query is run. Maybe a very simple example that you can play around with would help.

In the attached database, you can open the form, select a vendor from the combo box and click on the Preview Report button to view a report, or click on the Run Query button to run a query.


Then you can open the form in Design view and note these three essential properties of the combo box in the Properties sheet:
Name
Row Source
Column Count

And to view the code in the On Click event of a command button, you can click on one of the command buttons and look for the On Click property in the Event tab. When you put the mouse cursor in that property, a small button with three dots will appear at the end. You can click on that small button to open the code window and view the code for the On Click event of that command button.
.
 

Attachments

Okay, let's back up a bit, From the image you sent you arn't getting the drop down box yet? is that right?
lightray
 
Thanks Jon...I looked at it briefly and I think I might be able to make it work.

Lightray- Yes, you are correct.

Btw- Jon, I think your solution is still form based..meaning I still have to open the form and run the query/report from there. What I was hoping to do was when the user click a report (let's say this is a 'vendor report'), it will prompt the dialog box with the pull down menu, instead of opening the report from a form, hope I'm making sense.
Is this doable?
 
What I was hoping to do was when the user click a report (let's say this is a 'vendor report'), it will prompt the dialog box with the pull down menu
I don't think it's doable. If the query behind the report can't find a parameter value when the report is run, it just prompts the user to enter the value. It won't offer a pull down list of values for the user to select a value from.
.
 
Jon K said:
AccessNewbie72, your screenshot image suggests that the form is not open before the query is run. Maybe a very simple example that you can play around with would help.

In the attached database, you can open the form, select a vendor from the combo box and click on the Preview Report button to view a report, or click on the Run Query button to run a query.


Then you can open the form in Design view and note these three essential properties of the combo box in the Properties sheet:
Name
Row Source
Column Count

And to view the code in the On Click event of a command button, you can click on one of the command buttons and look for the On Click property in the Event tab. When you put the mouse cursor in that property, a small button with three dots will appear at the end. You can click on that small button to open the code window and view the code for the On Click event of that command button.
.

BUMP BUMP BUMP

this is what I have been trying to do allllllllllllll day, ive been going round the world and bend.

Thank you so much.

Lets hope I can look at your coding and combo boxes to see how you related everything
 
Hi, Leong!

Your combo box returns the value of ID, not the name (String). Because in the property of combobox you can see the Bound columns is No.1, means ID. So I have changed the criteria of your query, selecting byy ID.

Krava
 

Attachments

Users who are viewing this thread

Back
Top Bottom