Combobox date value in query

anissw

Registered User.
Local time
Today, 14:45
Joined
Jun 11, 2012
Messages
55
Hi. I have a form that have 2 combobox for date value ranges (CboStartDate and CboEndDate). My query generate order based on these dates ranges with no problem. I need to have 2 fields created in my query (WeekBegin and WeekEnd) with the values from the combbox start and end dates. So far, when I reference the combobox for my weekbegin and weekend fields and execute the query, nothing shows for these values. From my script below, can someone see what I need to do to have their values appear? Someway for the value of the comboboxes to appear in the fields?

Thanks-

Anissa:banghead:

SELECT BILL_IMPORTS.OWNERB, BILL_IMPORTS.SWHSB, Count(BILL_IMPORTS.[LINE COUNT]) AS [TOTAL ORDER], Sum(BILL_IMPORTS.[LINE COUNT]) AS [TOTAL LINE], Sum(BILL_IMPORTS.[ITEM COUNT]) AS [TOTAL ITEMS], Sum(BILL_IMPORTS.[Extra Items]) AS [TOTAL EXTRA ITEMS], Sum(BILL_IMPORTS.[BULK PLTS]) AS [TOTAL BULK PLTS], Sum(BILL_IMPORTS.[CONSOL PLTS]) AS [TOTAL CONS PLTS], Sum(BILL_IMPORTS.PICK_QTY) AS [TOTAL PICKS], Sum(BILL_IMPORTS.[PU Orders]) AS [TOTAL PICKUPS], Sum(BILL_IMPORTS.[PKGS COUNTS]) AS [TOTAL PKG COUNTS], Sum(BILL_IMPORTS.[EXTRA PKGS]) AS [TOTAL EXTRA PKGS], [Forms]![ORDER BILLING]![CboStartDate] AS WeekBegin, [Forms]![ORDER BILLING]![CboEndDate] AS WeekEnd
FROM BILL_IMPORTS
WHERE ((([Forms]![ORDER BILLING]![Text100])=[SWHSB]) AND (([Forms]![ORDER BILLING]![Client])=[OWNERB]) AND ((BILL_IMPORTS.[Ship Date]) Between ([Forms]![ORDER BILLING]![CboStartDate]) And ([Forms]![ORDER BILLING]![CboEndDate])))
GROUP BY BILL_IMPORTS.OWNERB, BILL_IMPORTS.SWHSB, [Forms]![ORDER BILLING]![CboStartDate], [Forms]![ORDER BILLING]![CboEndDate];
 
You might try explicitly defining the two date combo boxes with a parameter clause in your query:

PARAMETERS forms!form1!cboStartDate DateTime, forms!form1!cboEndDate DateTime;
SELECT BILL_IMPORTS.ownerb, BILL_IMPORTS.swhsb, BILL_IMPORTS.Ship_Date, forms!form1!cboStartDate AS WeekBegin, forms!form1!cboEndDate AS WeekEnd
FROM BILL_IMPORTS;

Since you are using an aggregate query, you will probably have to include the two date fields in the GROUP BY clause as well
 
Oh my goodness, it worked!!!

Thank you so much. :) :)
 

Users who are viewing this thread

Back
Top Bottom