filter report based on dates

I followed the below link to filter the report based on dates selected in the textbox
http://www.experts-exchange.com/Programming/Languages/SQL_Syntax/Q_28050231.html

It is not getting filtered it is showing the entire report. below is my code.

Textbox names
Shipment_Date_From
Shipment_Date_To
Field name in table is "Shipment_Date"

DoCmd.OpenReport "ShipmentReport_datewise", acViewPreview, "", "([Shipment_date]>=#" & Format(Forms!Reporting!Shipment_Date_From, "dd-mm-yyyy") & "#) And ([Shipment_date]<=#" & Format(Forms!Reporting!Shipment_Date_To, "dd-mmm-yyyy") & "# )"


Can anyone help to sort out this
LVL 31
MAS (MVE)EE Solution Guide - Technical Dept HeadAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
what data type are the fields Shipment_Date ? text of date?

anyhow, try the US format:
DoCmd.OpenReport "ShipmentReport_datewise", acViewPreview, "", "([Shipment_date]>=#" & Format(Forms!Reporting!Shipment_Date_From, "mm/dd/yyyy") & "#) And ([Shipment_date]<=#" & Format(Forms!Reporting!Shipment_Date_To, "mm/dd/yyyy") & "# )" 

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Guy Hengel [angelIII / a3]Billing EngineerCommented:
the above presumes the field is date.
if it's text, with the format dd-mm-yyyy you cannot use >= and <= directly ...
0
mbizupCommented:
Try this:
DoCmd.OpenReport "ShipmentReport_datewise", acViewPreview, "", "Format([Shipment_date], "yyyy-mm-dd")>='" & Format(Forms!Reporting!Shipment_Date_From, "yyyy-mm-dd") & "') And ([Shipment_date]<='" & Format(Forms!Reporting!Shipment_Date_To, "yyyy-mm-dd") & "' )"

Open in new window

0
Newly released Acronis True Image 2019

In announcing the release of the 15th Anniversary Edition of Acronis True Image 2019, the company revealed that its artificial intelligence-based anti-ransomware technology – stopped more than 200,000 ransomware attacks on 150,000 customers last year.

MAS (MVE)EE Solution Guide - Technical Dept HeadAuthor Commented:
Thanks it worked with mm-dd-yyyy
 I appreciate if you can guide how to make it landscape.
As of now it is opening in portrait
0
Guy Hengel [angelIII / a3]Billing EngineerCommented:
you have 2 options: define the report once and for all to be landscape (open the report, set the setting in the page setup options, save), or you can do it by code:

DoCmd.OpenReport "ShipmentReport_datewise", acViewDesign
Reports("ShipmentReport_datewise").Printer.Orientation = acPRORLandscape

and then you call it with avViewpreview like above
0
MAS (MVE)EE Solution Guide - Technical Dept HeadAuthor Commented:
Many thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.