Filter dates values by a month

Falcon88

Registered User.
Local time
Today, 16:36
Joined
Nov 4, 2014
Messages
318
Hiiii all dears

I have a Main form (unbound) , contains a combobox "Mycmb" its sourceraw:
Code:
SELECT Month(Format([OrderDate],'mm yyyy')) AS MyMnthNo, Format([OrderDate],"mmmm yyyy") AS MyMnth
FROM tblOrders
GROUP BY Month(Format([OrderDate],'mm yyyy')), Format([OrderDate],"mmmm yyyy");
and subfrm its recordsource :
Code:
SELECT tblOrders.OrderID, tblOrders.OrderDate, tblOrders.OrderShift
FROM tblOrders;

how to filter ( in "OrderDate" field) that subform by choosing a month in "Mycmb", ?
( not by criteria in recordsource of subfrm ) .
 
the form query needs to show all records with 1 extra field:
MONTH([DATEFLD])
then when user picks a month in the combo, filter the data, dont reset the query.

Code:
sub Mycmb_Afterupdate()
if isNull(Mycmb) then
   me.filterOn = false
else
   me.filter = "month=" & Mycmb 
   me.filterOn = true
end if
end sub
 
the form query needs to show all records with 1 extra field:
MONTH([DATEFLD])
then when user picks a month in the combo, filter the data, dont reset the query.

Code:
sub Mycmb_Afterupdate()
if isNull(Mycmb) then
   me.filterOn = false
else
   me.filter = "month=" & Mycmb 
   me.filterOn = true
end if
end sub

Ok thes works good , very thanks .
i have another subform ("sub2") in that main form and contains a date (data field) , but its recordsource is a table "tblOrders" (Not a query) , i am added an unbound field in that subfrm like "MONTH([DATEFLD])" , and try that code but not works good .

please help
 

Users who are viewing this thread

Back
Top Bottom