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!

All and combo box

Status
Not open for further replies.

primagic

IS-IT--Management
Jul 24, 2008
476
GB
I have the following sql for the record source of an unbound combox

Code:
SELECT ManagerID, BDName FROM tblManagers UNION SELECT 0 As ManagerID, "*All Managers*" As BDName FROM tblManagers ORDER BY BDName;


However when I select all and try to run the report, I get no results.

Here is my query for the report:

Code:
SELECT tblProspects.ProspectID, tblProspects.ProspectName, tblProspects.Manager, "*All Managers*" AS Expr1, tblProspects.Segment, tblProspects.ProspectCurrency, tblProspects.Status, tblProspects.Channel, tblProspects.AlliancePartner, tblProspects.Industry, tblProspects.Region, tblProspects.County, tblProspects.Campaign, tblProspects.Turnover, tblProspects.TotalspendavailableERAReview, tblProspects.TotalSpendSigned, tblProspects.SpendSignedforImmediateStart, tblProspects.NumberOfStaff, tblProspects.DateOfFirstMeeting, tblProspects.ForecastDecisionMonth, tblProspects.ProgressedtoClient, Format([ForecastDecisionMonth],"mmm") AS MonthText
FROM tblProspects
WHERE (((tblProspects.Manager)=[Forms]![frmMainMenu]![sfrmWorkspace].[Form]![cboManager]) AND ((tblProspects.ForecastDecisionMonth) Between [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtFromDate] And [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtToDate]) AND ((tblProspects.ProgressedtoClient)=No)) OR ((("*All Managers*")=[Forms]![frmMainMenu]![sfrmWorkspace].[Form]![cboManager]) AND ((tblProspects.ForecastDecisionMonth) Between [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtFromDate] And [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtToDate]) AND ((tblProspects.ProgressedtoClient)=No));

If I select any other option other than ALL I get results
 
What about this where clause ?
Code:
WHERE (tblProspects.Manager=[Forms]![frmMainMenu]![sfrmWorkspace].[Form]![cboManager] OR [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![cboManager]=0)
 AND tblProspects.ForecastDecisionMonth Between [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtFromDate] And [Forms]![frmMainMenu]![sfrmWorkspace].[Form]![txtToDate]
 AND tblProspects.ProgressedtoClient=No

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top