View Full Version : Forcing user to select a value from list


hgus393
06-07-2009, 11:56 PM
Hi,
I am at a loss trying to suss out how to do this. What I am trying to do is:
I have a report that shows a report for 5 units. Now I want the users to be able to choose which unit they want the report to display. The report is based on a pretty simple select query. I have been toying with the idea of using a simple form poping up where the user can select which unit they want..But the way to go from the form to the final report is where I fail. Has any of you guys done this before, any hints? :confused:
Cheers
Bob

khawar
06-08-2009, 12:31 AM
Where you are having problem tell some detail

hgus393
06-08-2009, 01:07 AM
Well what I am having difficulties with is how to actually perform the linkage of the form (where the user can select the unit) to the query that dispalys the report...so basically from scratch I guess...
Bob

khawar
06-08-2009, 01:07 AM
can you upload some sample data

Lyconal
06-08-2009, 01:44 AM
You will need to reference the unbound text box from the form you wish to run the query from, to the QUERY CRITERIA for the selected search.

Cheers

hgus393
06-08-2009, 04:24 AM
Aha, is it that easy? :rolleyes:
Will give that a whirl!
Cheers
Bob

gemma-the-husky
06-08-2009, 05:19 AM
lyconal is right

for any report/form you basically need to base it on a query, which is designed to select only the data in which you are interested.

you use the criteria row(s) of the query to define your selections - this can either be

explicitly hard type

<= #31/12/08# ie up to 31st dec 2008


obtain from user at run time, as a query parameter

<= [enter required date]


but more likely (more flexibly!), referring to a field on a form

<= forms!someform!selectiondate (same thing)

the syntax for this latter example has to be right, and this example may be slightly off, but you should get the picture


or in a similar fashion by testing a variable, which HAs to be with a function

<= function_to_read_a_variable() (again same thing)

-----------
the criteria etc, for a query can be very much more complex - which is why 99&#37; of the time the answer to anything in access IS a query.

hgus393
06-08-2009, 06:03 AM
Wow, that is a very good explanation! I have however a little problem with this. It is no problem setting up a form that is linked to the query and thereafter the report. But how can I make the query choose all the records if nothing is choosen (ie unit is blank)?:confused:
Bob

hgus393
06-08-2009, 06:25 AM
Never mind found a solution:

[Forms]![myForm]![myControl] OR [Forms]![myForm]![myControl] Is Null

Bob:D