Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Filter form by using a combo box 1

Status
Not open for further replies.

Mack2

Instructor
Mar 12, 2003
336
US
When I open a form, it shows all of the current project's for a company. I need to add a combo box that will list all of the project manager's. When a user selects a manager from the combo box, it should filter the form, based on that selection. So it will show all of the projects for that manager.

THANKS FOR YOUR HELP!!!!!
 
First, if you did a search on this and the other Access forums, you would have found that this has been answered quite a few times.
One way:
Create your combobox. Create your rowsource eq.
SELECT Distinct [Manager] FROM tblName ORDER BY [Manager];

Then on the AfterUpdate event put:

Private Sub Comboboxname_AfterUpdate()

Dim SQLText
SQLText = "Select * From [tblName] Where [Manager] = " & Me![comboboxname]
Forms![YourFormName].RecordSource = SQLText
Me![comboboxname] = Null

End Sub

Substitute your field and comboboxname and formname.
 
How are ya Mack2 . . .

Have you tried the [blue]Combobox Wizard[/blue] selecting the option: [blue]Find a record on my form based on the value I selected in my combobox[/blue]?

Calvin.gif
See Ya! . . . . . .
 
Hi AceMan1! Yes, I did try that. The form is in datasheet view, and all it does it select one record. I need it to filter. Thanks again for the issue you help me with a couple of months ago! I hope you stay in the hospital was not anything serious.

Fneily, Thanks that worked. I did search google for this issue, and did not find anything. I was not thrilled that I could not figure it out myself
 
Mack2 . . .

I somehow missed your use of [blue]DataSheet View[/blue].

Be aware: a form in datasheet view looses quite a bit of [blue]form functionality[/blue]. However you can [blue]make a continuous form look just like a datasheet[/blue] and regain full functionality. You'll have no problems with wizards here!

Give it a shot and try the combo wizard again to see what I mean! . . .

Calvin.gif
See Ya! . . . . . .
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top