Dumb Date Question

  • Thread starter Thread starter afr0ninja
  • Start date Start date
A

afr0ninja

Ok, I admit I'm self taught with Access, and that I'm not necessarily
the brightest crayon in the box however, I cannot figure out a stupid
command button date function for the life of me.

I have a command button set up as

txtDate.Value = Now()
BusUnit.SetFocus

The problem is that the Now() function puts in the time into the date
field. This is causing hell with my date queries where I'll miss
information or if I add a +1 to the end of the date range it grabs an
extra date so I really want to simply get rid of the times entered into
the form.

I've tried things I've found on the forum like

me.txtdate = date

It seems that if I try to use 'date' instead of 'now' the code will
just set focus to the next field and not enter a date.

Any assistance or thoughts would be greatly appreciated. Please keep
in mind that I'm rather new to coding so any detailed information would
be.. uhm.. greatly, greatly appreciated!

Thanks in advance!
 
Do you have a field in your table, or a control on your form, or a function
in your application, or anything else named Date?

Date is a function, just like Now. They should elicit identical behaviour.
 
Instead of

me.txtdate = date

try

me.txtdate.Value = date()

--
There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

Message posted via AccessMonster.com
 
Ok. I think I have come to the conclusion that I need to quit making
databases and go bang my head on a wall for awhile. The table field is
called 'date'. Which now makes perfect sense why it wasn't working
properly. I can't believe I'm that dense =\. I guess now I get to
look to see how much gets broken if I rename the table or just do
without the date button =x. Thank you much for your help!!!
 
afr0ninja said:
Ok. I think I have come to the conclusion that I need to quit making
databases and go bang my head on a wall for awhile. The table field is
called 'date'. Which now makes perfect sense why it wasn't working
properly. I can't believe I'm that dense =\. I guess now I get to
look to see how much gets broken if I rename the table or just do
without the date button =x. Thank you much for your help!!!

A little advice, if I may. DO NOT name ANY field in your table with a name
that is a reserved name in Access. You will only need to change the field
name, not your table name.
 
Back
Top