View Full Version : quries in layout of form


janed
02-12-2002, 06:28 AM
i have a table with various record entered. i have four parameters set. rather then these coming up in individual boxes i want them to be like a form. any ideas?
i then want the query to look up the first two of these parameter valus in my table and give me a report of all records containing these values. pls help!!

Jack Cowley
02-12-2002, 06:42 AM
You say you have 4 parameters set but only want to use the first 2. If that is the case then create a form with 2 unbound text boxes and a command button. Assuming the fields are called Field1 and Field2 and the form is called Form1 put this code in the Criteria field of the 2 columns in your query that you want to search on:

[Forms]![Form1]![Field1] in the first criteria field.
[Forms]![Form1]![Field2] in the second criteria field.

The command button should open the query, form or report that is based on the query. Be sure to remove the extra criteria if you really only want to select on two fields.

adz2013
02-12-2002, 06:44 AM
If you want to use all 4 then add two more unbound text boxes and do the same thing as the other ones.

janed
02-12-2002, 06:48 AM
i dont really understand how this will work. if i do this will it give me a report with all the fields of the record that contains that data from the parameter. i cant really get my head around reports which isnt helping.

Jack Cowley
02-12-2002, 11:43 AM
In your query drag all the fields from your table that you want to display in your report.

If, for example, you want to show records were the LastName is Smith and FirstName is Joe then in the LastName Criteria field you would put [Forms]![FormName]![LastName]. In the FirstName Criteria you would put [Forms]![FormName]![FirstName]. I have assumed that FirstName and LastName are the names of the fields on the form that I suggested you create.

Now your user comes along and types in Smith in the LastName field on the form and Joe in the FirstName field. Now when you open the report that is based on the query you will see ALL the records where the LastName is Smith and the FirstName is Joe.