Combo Box & Filter

P

Pam

I have 5 loications that have multiple people associated to them in a query.
I want my combo box to only show the 5 locations not the same location over
and over again because more than one entry has this location. Any help would
help thanks
 
R

Reggie

Pam, change your query to a Totals query and group by Location. The other alternative, if its
always the same five locations is to make your combo into a Value List and type in the locations for
the row source of the combo.

Hope it helps!
 
A

Annelie

In design view, on your icon bar there is this Greek looking E - just like
in excel, click that and it will add a group field. Then you must choose how
to group each field. For Location you would use "group by"
Annelie
 
P

Pam

I have a query which returns 1000 of users in 5 different location how do i
create a combox to return only the users in lets say one location i pick from
the drop down box at a time any help is help thanks
 
R

Reggie

Pam, change your select query to a totals query by either clicking the Greek looking E on the
toolbar or select View/Totals from the main menu. Add the Location and User fields to the query and
set both to Groupby. Under the Locations field type in the following on the criteria line (changing
the names with the names of your form and combobox).
=Forms!frmYourForm!cboYourCombo

Now set your forms/reports recordsource to this query. In the afterupdate event of the combobox
click the ellipsis(...) to open the code window and type in the follow:

Private cboYourCombo_AfterUpdate()
Me.Requery
'Or if the data is on a subform
Me.mySubForm.Form.Requery
End Sub

Hope this helps!
 
P

Pam

Isnt there any easier way it doesnt seem to work because my query comes from
two tables so it doesnt work is there any other way??
 
R

Reggie

Pam, I guess I'm not really understanding exactly what you're trying to accomplish. Maybe someone
else here understands and can offer more assistance cause in regards to your description of what "I"
thought you were trying to accomplish, these are solutions I came up with. I don't understand what
you mean by your query comes from 2 tables. Assuming your tables are tblLocations and tblUsers and
you have fields/relationships something like this things should work fine:

tblLocation:
LocationID (primary key)
LocationName
etc.

tblUsers:
UserID (primary key)
LocationID (foreign key)

If you have something else or can give more details I'd gladly try to help further.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top