=> Date Range

R

Rhonda Fischer

Hello,

I would like to use the date values typed into my
access form to create a date range for my query.
The problem is that the dates typed on the form will
be for example:

txtDateFrom: 26/01/2004
txtDateTo: 27/01/2004

and the dates recorded in my table column include the
time:

26/01/2004 23:42:00

So to try and resolve this I would like to place a mask
and a default time value - not seen by the user
on my text box:

txtDateFrom 00:00:00
and txtDateTo 23:59:00

I'm using: 99/99/0000\ 00:00;0;_ and
99/99/0000" 24":00;0;_

But then the user is required to type in the time as well
and to reduce confusion I just want them to type in the
date. How can I attach a time to the date typed in by the
user?

Your thoughts would be much appreciated.

Thank you kindly
Rhonda
 
M

Marshall Barton

Rhonda said:
I would like to use the date values typed into my
access form to create a date range for my query.
The problem is that the dates typed on the form will
be for example:

txtDateFrom: 26/01/2004
txtDateTo: 27/01/2004

and the dates recorded in my table column include the
time:

26/01/2004 23:42:00

So to try and resolve this I would like to place a mask
and a default time value - not seen by the user
on my text box:

txtDateFrom 00:00:00
and txtDateTo 23:59:00

I'm using: 99/99/0000\ 00:00;0;_ and
99/99/0000" 24":00;0;_

But then the user is required to type in the time as well
and to reduce confusion I just want them to type in the
date. How can I attach a time to the date typed in by the
user?


You xould use the control's BeforeUpdate event to stick a
time value on the date:

txtDateTo = CDate(CLng(txtDateTo))
txtDateFrom = CLng(txtDateFrom) + #23:59:59#

but that seems more than a little hokey to me. It would be
better to use a different criteria in the query. Instead of
using:
Between Forms!frm.txtDateTo And Forms!frm.txtDateFrom

try this instead:
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top