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

Filter by Date

Status
Not open for further replies.

edgarchado

Technical User
Apr 5, 2005
59
AR
Hi,

I am using a form to filter a report by different criteria. These are a Order ID (number), Date (date) and Client (string). I have no problem when filtering by client and Order Id, but I do have a problem with the date. I do not use the american format for dates (mm/dd/yyy), instead I use dd/mm/yyyy.

The problem is that the filter is using the american format, but I need to use the other format.

I am using this code for sending the date filter to the report:

Case 1 ' Date
strSQL = strSQL & "[" & Me("Filter" & intCounter).Tag & "] = #" & Me("Filter" & intCounter) & "# And

Should I change anything?

Thanks.

 
edgarchado
If you use your date format, dd/mm/yyyy, consistently you can change the way dates show in your Windows system set-up and then Access always follows what's in the system set-up.

I'm not sure if this is getting in the way, but you should rename your Date field to something else (maybe MyDate), because Date is a reserved word in Access.
That could be causing your problem when you attempt to filter by a date.

Tom
 
Tom,

What appear as 'Date is just a comment in the code. I have already changed the date format in my system, and I still have the same problem.

I do not know what else to do.
 
edgarchado
I understand what you are saying about the Date being a comment in the code. However, I noticed you mentioned three fields in the original post - OrderID, Date and Client - and was going by that.

In any event, it's hard to follow your SQL because actual fields don't show up there.

The WHERE clause in an SQL that selected by dates might look something like this...
"[MyDateField] = Forms!YourFormName!DateField"

Also, I just had a thought. You said that you changed the system to accomodate the dd/mm/yyyy format, but that didn't solve anything. Take a look in the tables and see what format the dates are stored in.

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top