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

Union Query - Select All

Status
Not open for further replies.

PHV

MIS
Joined
Nov 8, 2002
Messages
53,708
Location
FR
SELECT CreditController FROM qryFilteredCreditControllers
UNION SELECT 'All' FROM qryFilteredCreditControllers

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
This works in that I dont receive the error anymore, but its retrieving no records.

 

What do you get when you run the statements separately:
Code:
SELECT CreditController FROM qryFilteredCreditControllers
and then
Code:
SELECT 'All' FROM qryFilteredCreditControllers
???

Have fun.

---- Andy
 

What CODE do you have on your combo box?
Since 'ALL' is not a valid entry in your table/query, you need to tell Access what you want to happen when it's selected.

Randy
 
My combo box works fine now. in a query I have used the 'All' as below:

Code:
PARAMETERS [Forms]![frmDashboard]![FromDate] DateTime, [Forms]![frmDashboard]![ToDate] DateTime, [Forms]![frmDashboard]![InvoiceDate] DateTime, [Forms]![frmDashboard]![cboBanks] Text ( 255 ), [Forms]![frmDashboard]![cboMortgageType] Text ( 255 ), [Forms]![frmDashboard]![cboCreditController] Text ( 255 );
SELECT TESTAC.AccountNumber, TESTAC.ClientName, TESTAC.ClientType, TESTAC.Address, TESTAC.AddressType, TESTAC.Area, TESTAC.Field8, TESTAC.Fee, TESTAC.VAT, TESTAC.Outlay, TESTAC.Total, TESTAC.TypeofBilling, TESTAC.Mins, TESTAC.FeeEarner, TESTAC.Field17, TESTAC.Field18, TESTAC.Field19, TESTAC.Field20, TESTAC.CreditController, "All" AS Expr1
FROM TESTAC
WHERE (((TESTAC.ClientType)=[Forms]![frmDashboard]![cboMortgageType]) AND ((TESTAC.AddressType)=[Forms]![frmDashboard]![cboBanks]) AND ((TESTAC.Field8) Between [Forms]![frmDashboard]![FromDate] And [Forms]![frmDashboard]![ToDate]) AND ((TESTAC.CreditController)=[Forms]![frmDashboard]![cboCreditController])) OR (((TESTAC.ClientType)=[Forms]![frmDashboard]![cboMortgageType]) AND ((TESTAC.AddressType)=[Forms]![frmDashboard]![cboBanks]) AND ((TESTAC.Field8) Between [Forms]![frmDashboard]![FromDate] And [Forms]![frmDashboard]![ToDate]) AND (("All")=[Forms]![frmDashboard]![cboCreditController]))
ORDER BY TESTAC.Field8;

This retrieves the correct results but only in the query. not in the report that I need to produce
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top