Show records for Today

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello experts,

This should be simple but it's driving me crazy!

I have a Tickets table one of it's field is [Date] it works as a time stamp
it's formated to (Long date)

I also have a form with a command button that stamps the time:
me.date=now()

Now in a query I only want to show records that matches today's date only
date() but I always get no records. I think its a problem with Time because
when I enter today's date manually it appears in the query!

What should I do? can I perform formatting with command button? or what
should I do?

Thanks,
 
First, DATE is a reserved word. Please rename your field.

If you are storing a date, the I would do me.SomeField = Date(), not
Now().
 
You can use one of the following as criteria

Field: [Date]
Criteria: >= Date() and < Date() -1

or
Field: JustTheDate: DateValue([Date])
Criteria: Date()

DATE is a bad name for a field. If you can rename it to SalesDate or
something else. Date() is a function that returns the system date time.


Rick B said:
First, DATE is a reserved word. Please rename your field.

If you are storing a date, the I would do me.SomeField = Date(), not
Now().



--
Rick B



Aminov said:
Hello experts,

This should be simple but it's driving me crazy!

I have a Tickets table one of it's field is [Date] it works as a time
stamp
it's formated to (Long date)

I also have a form with a command button that stamps the time:
me.date=now()

Now in a query I only want to show records that matches today's date only
date() but I always get no records. I think its a problem with Time
because
when I enter today's date manually it appears in the query!

What should I do? can I perform formatting with command button? or what
should I do?

Thanks,
 
Hi Rick,

Thanks for your comment on the Date field name, I fixed that.

Well, Natuarally I would use the syntax you typed here but as soon as I
press Enter the compiler ommits the"()" from Date:
Me.[TicketDate]=date

I simply ignore this behaviour and continue testing my form's control,
pressing the button does not record anything in the [TicketDate] it leaves it
blank! that's why I'm trying the Now().

The problem with now() is it stores both date & time maybe that's why
putting date() as a criteria for my query is not returning any results
(although there is) but adding some operators like >,<,<>,etc returns the
results as they should!

What should I do next? is it something in the structure?

Thanks again



Rick B said:
First, DATE is a reserved word. Please rename your field.

If you are storing a date, the I would do me.SomeField = Date(), not
Now().



--
Rick B



Aminov said:
Hello experts,

This should be simple but it's driving me crazy!

I have a Tickets table one of it's field is [Date] it works as a time
stamp
it's formated to (Long date)

I also have a form with a command button that stamps the time:
me.date=now()

Now in a query I only want to show records that matches today's date only
date() but I always get no records. I think its a problem with Time
because
when I enter today's date manually it appears in the query!

What should I do? can I perform formatting with command button? or what
should I do?

Thanks,
 
Back
Top