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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

filter a active form

Status
Not open for further replies.

Ryon

Technical User
Nov 1, 2002
64
US
hello,
I have a client form and each client goes into a lab(LAB#)
I 'm trying to filter the form based on a combo box(combo60)
the combo box is on the client form and contains all of the lab#'s. Help!!and Thanks
 
Hi

There is more that one way to do this, but one way is change the recordsource of the form (ie the SQL) to reflect the combo box choice

in the after update event of the Combo something like:

Me.Recordsource = "SELECT .... WHERE Lab = " & cboLabNo & ";"
Me.Requery

Note if LAbNo is string rather tahn numeric you need ' so:

Me.Recordsource = "SELECT .... WHERE Lab = '" & cboLabNo & "';" Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
could you be more specific and maybe give me another option. I want to the Query that the form pulls from and for the lab criteria, I pointed it to the combo box on my form. then i copyed the SQL for that query and placed it in my code. I am not good with SQL and this is giving me problems. here is what I had in the combo box after update event. I am definetly doing something wrong. thanks

Private Sub Combo137_AfterUpdate()
me!recordsource = "SELECT TBLELOACLIENT.[City] & ", " & [State] & " " & [Zip] AS CSZ, TBLELOACLIENT.KEY, TBLELOACLIENT.[Client Name], TBLELOACLIENT.City, TBLELOACLIENT.State, TBLELOACLIENT.[Phone #], TBLELOACLIENT.[Dedicated Phone #], TBLELOACLIENT.[Contact Name], TBLELOACLIENT.[Internet Service], TBLELOACLIENT.[Sales Rep], TBLELOACLIENT.[Lab Acct#], TBLELOACLIENT.[Download Status], TBLELOACLIENT.[Company Code], TBLELOACLIENT.[Serial #], TBLELOACLIENT.Comments, TBLELOACLIENT.[Lab #], TBLELOACLIENT.[Address 1], TBLELOACLIENT.[Address 2], TBLELOACLIENT.Zip, TBLELOACLIENT.[Fax Number], TBLELOACLIENT.Leased, TBLELOACLIENT.Purchase, TBLELOACLIENT.Marketing, TBLELOACLIENT.Assumed, TBLELOACLIENT.NotInUse, TBLELOACLIENT.[Remo Removed], TBLELOACLIENT.[Install Date], TBLELOACLIENT.EquipSet, TBLELOACLIENT.Installer, TBLELOACLIENT.RecoveryComments, TBLELOACLIENT.VERIFIED, TBLELOACLIENT.[Connection Type], TBLELOACLIENT.[EMAIL ADDRESS], TBLELOACLIENT.PMS, TBLELOACLIENT.RemovedDate_
FROM TBLELOACLIENT
WHERE (((TBLELOACLIENT.[Lab #])=[Forms]![FrmClients]![Combo137]));"
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top