Access Form To Query by Date Range

tyger0951

Board Regular
Joined
Aug 9, 2014
Messages
103
I'm using a form to put criteria into a query. I'm using date ranged but if i input date range
Code:
<code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">03/07 - 03/13</code>
it returns
Code:
<code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">03/02 , 03/03 , 03/04, 03/05 , 03/06 , 03/07 , and 03/13</code>
instead of the correct results. I've tried changing the format Type from
Code:
<code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">Medium Date</code>
and
Code:
<code style="margin: 0px; padding: 1px 5px; border: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, sans-serif; white-space: pre-wrap; background-color: rgb(238, 238, 238);">Short Date</code>[FONT=Consolas]
[/FONT] having the form and query match on formats.With no luck. Can anyone help me figure this out ?
Form_zpswjf346ns.png
[/URL][/IMG]
Query_zpsz3rlynfx.png
[/URL][/IMG]
Results_zps6zvxs99g.png
[/URL][/IMG]

 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
03/07 - 03/13

This is not the way to input a date range. It can be interpreted as text or a mathematical expression (3 divided by 7 minus 3 divided by 13). You really need to have two input fields: START_DATE and END_DATE. Then you can write a proper query, assuming you have proper data types (DATETIME datatypes).

Short date/Medium date is only about formatting. It has nothing to do with the underlying, or stored values. The underlying values should be true dates, and as such are decimal numbers pure and simple.
 
Upvote 0
sorry had been inputting 03/7/2015 and 03/13/2015. I got it to work by using Datevalue() and switch to >= and <= instead of betwee.
 
Last edited:
Upvote 0
I got it to work by using Datevalue() and switch to >= and <= instead of between
Welcome to the dark side.
 
Upvote 0

Forum statistics

Threads
1,216,533
Messages
6,131,216
Members
449,636
Latest member
ajdebm

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