Kevin Smith
asked on
How do I add a "show only these" checkbox to an Access form that exports a query?
I have a form that let's the user export a query to Excel. I give them a combobox that let's them choose the year so my query will only return the year they select. I also have a status field, but I want them to be able to check a box on the form that says "show only completed and in progress." If that box isn't checked, I want it to just return all records.
This isn't working: Like IIf([forms]![frm_SEERRatin gs]![Check 17]="TRUE" ,([dbo_tbl _ProjectTr acking].[p tStatus])= "In Progress" Or ([dbo_tbl_ProjectTracking] .[ptStatus ])="Comple ted",'*')
What am I doing wrong?
Thanks!
This isn't working: Like IIf([forms]![frm_SEERRatin
What am I doing wrong?
Thanks!
ASKER
Not getting it. It returns nothing if I check it and freezes if I leave it unchecked. Here's the complete sql:
SELECT dbo_tbl_ProjectTracking.pt Status AS Status, dbo_tbl_ProjectTracking.Bu dgetYear AS [Budget Year], dbo_tbl_Jobs.JobNumber AS [MSS Job Number], dbo_tbl_Locations.UnitNumb er AS [Hotel #], dbo_tbl_Locations.Property Title AS [Hotel Name], dbo_tbl_ProjectTracking.MP rojectNumb er AS [Marriott Project #], dbo_tbl_ProjectTracking.Pr ojectTitle AS [Project Title], dbo_tbl_ProjectTracking.Sc ope AS [Project Scope], dbo_tbl_SEERRating.UnitNam e AS [Unit Type], dbo_tbl_SEERRating.Numbero fUnits AS [# of Units], dbo_tbl_SEERRating.SEER AS [SEER Rating], dbo_tbl_SEERRating.EER AS [EER Rating], dbo_tbl_SEERRating.RatingN otes AS Notes, dbo_tbl_PM.PMName AS [Project Manager]
FROM (((dbo_tbl_ProjectTracking LEFT JOIN dbo_tbl_Jobs ON dbo_tbl_ProjectTracking.Pr ojectID = dbo_tbl_Jobs.ProjectID) LEFT JOIN dbo_tbl_Locations ON dbo_tbl_Jobs.Location = dbo_tbl_Locations.Location ID) LEFT JOIN dbo_tbl_SEERRating ON dbo_tbl_ProjectTracking.PT ID = dbo_tbl_SEERRating.Project TrackingID ) LEFT JOIN dbo_tbl_PM ON dbo_tbl_Jobs.PM = dbo_tbl_PM.PMID
WHERE (((dbo_tbl_ProjectTracking .ptStatus) Like IIf([forms]![frm_SEERRatin gs]![Check 17]=-1,([d bo_tbl_Pro jectTracki ng].[ptSta tus])="In Progress" Or ([dbo_tbl_ProjectTracking] .[ptStatus ])="Comple ted",'*')) AND ((dbo_tbl_ProjectTracking. BudgetYear ) Like Nz([Forms]![frm_SEERRating s]![Combo7 ],'*')) AND ((dbo_tbl_Jobs.CustomerID) =71));
SELECT dbo_tbl_ProjectTracking.pt
FROM (((dbo_tbl_ProjectTracking
WHERE (((dbo_tbl_ProjectTracking
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
That got it, thanks once again Cap!
ASKER
Uh oh, it lost the AND. If I put a year in it returns nothing...ideas?
Like IIf([forms]![frm_SEERRatin
or
use -1
Like IIf([forms]![frm_SEERRatin