Date range problem in query

fdavidgolf

New Member
Joined
Apr 23, 2002
Messages
26
The date is stored MMDDYY. I want the query to select between dates and the user enter dates normal like mm/dd/yyyy.
The where statement would be between [Enter From Month - MM/DD/YYYY] and [Enter To Month - MM/DD/YYYY]. Would I have to reformat the date range using Left, Mid and Right methods? I am having no success reformating the MMDDYY field to YYYYMMDD. What is the best way to do this ?
Thanks!
 

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.
Hi Dave ! I am having trouble with different years. If I reformat the date from the data as YYYYMMDD, then I can get date over several years, but I don't want the user to enter dates that way. Between 100202 (Oct 2,2002) and 011503 (Jan 15, 2003) would not work. 021002 and 030115 would work. That make sense ?
Thanks!
 
Upvote 0
Just re read your post, if the field is a date field with properties set mmddyyyy, all you need to do is change it to yyyymmdd that should do it, it certainly does on on the one I have (copy it first)

Dave
 
Upvote 0
Dave, the field properties cannot be changed. The data is coming in thru ODBC to an SQL Tandem database. It is defined numeric there. I always leave out info, sorry. Thanks!
 
Upvote 0
On 2003-02-17 16:21, fdavidgolf wrote:
Between 100202 (Oct 2,2002) and 011503 (Jan 15, 2003) would not work. 021002 and 030115 would work. That make sense ?
Thanks!

It looks to me as though your field is not formatted as a date/time field, if it was a date/time field you could set its format to yyyy/mm/dd with a input mask set to 0000/00/00 that way, there could be no mix up with dates. Insert another field, set as above, then copy and paste your data down into it. You should get the correct results

Dave
 
Upvote 0
and I forgot to say, this will be run monthly or on demand. I am trying to use one macro to get all the Leave data of all employees. The macro runs all queries that make tables and runs reports. The macro needs to do it all.

More replies coming, thanks!
 
Upvote 0

Forum statistics

Threads
1,221,499
Messages
6,160,169
Members
451,629
Latest member
MNexcelguy19

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top