English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

Does anyone know how you can do a query that you select the criteria with a drop down box. In the table/forms it is easy enough to do, but how do I creat a query with a table and then in the criteria for the query have my query as a drop down box (i.e the comand would read [Select salary] and when the quer is run insted of me typing in the salary it offers me a drop down box of certain values? Please help

2006-10-23 13:33:19 · 4 answers · asked by hairyhaggis_uk 2 in Computers & Internet Programming & Design

4 answers

If you don't want to get into coding try this. View your Query as a Datasheet then under the Filter menu you'll see Filter by Form and Advanced Filter. Play around with them to see if they offer a suitable solution.

Alternatively you can do it by creating a Customised Parameter Form - see link for full details:
http://www.fontstuff.com/access/acctut08.htm

Other possible solution
http://www.fontstuff.com/access/

Good luck.

2006-10-23 22:30:16 · answer #1 · answered by Anonymous · 0 0

Here's what I did:

I created a query called "product by date". In that query I dragged over all the fields I wanted to use. One of these fields was saved as a drop down list in the table it was created in.

Then I saved this query and created a form based on the query.

On that form I dragged from the field list the drop down field "Product" . I then created a text box and made this into a date format box. I created 2 of these, of one which was titled Start Date and the other End Date. The idea is that I can choose a product from the drop down list and then enter a start and end date so I can see all the results of how many issues were daten between certain dates.

I saved that and went back to the query.

Now here's the difficult part. In the criteria secion under the field which is the drop down field I had to tell it where the information was coming from to run the query. So I typed this in:

[Forms]![Product Query by Date]![Combo10]

This tells the query that the selection is coming from a form called Product Query by Date and it's the combo box called combo 10 on that form.

Then, so that I can run the query against a start date and end date I went to the criteria of my field called "Date Taken" and entered this:

Between [Forms]![Product Query by Date]![Text16] And [Forms]![Product Query by Date]![Text18]

This tells the query that when running use the first take on the same form as the combo box but look at the text box called Text16 then get the end date from the text box called Text18.

I then saved the query (obviously depending on what you've called the forms and the boxes then your text will differe slightly.

To make the whole thing run then I went back to the form and produced a button which I labelled RUN QUERY. Using code I entered this to get that button to run the query with the information I had entered:

Private Sub Query_Click()
On Error GoTo Err_Query_Click

Dim stDocName As String

stDocName = "Product Query by Date"
DoCmd.OpenQuery stDocName, acNormal, acEdit

Exit_Query_Click:
Exit Sub

Err_Query_Click:
MsgBox Err.Description
Resume Exit_Query_Click

THAT'S BASICALLY IT.

If you can make sense of that good luck!!!

2006-10-24 07:53:28 · answer #2 · answered by Anonymous · 0 0

hm.. you mean : in your form table grid, you want to make a dropdown combobox (lookup combo) which related to the other table (in salary table) ?
I've never use MS Access before, try this site : http://support.microsoft.com/kb/304462

2006-10-24 01:39:14 · answer #3 · answered by Manzana verde 5 · 0 1

Have you made the salary database?

2006-10-23 20:45:36 · answer #4 · answered by IC 4 · 0 0

fedest.com, questions and answers