Dateserial same every time

  • Thread starter szag via AccessMonster.com
  • Start date
S

szag via AccessMonster.com

I don't know what I am doing wrong but I am using DateSerial as a default in
a textbox and no matter what I keep getting 1/31/2010.

I have tried to put in anything just to get it to be something other than
1/31/2010...DateSerial(Year(Date()),Month(Date()),0) AND DateSerial(Year
(DateField), Month(DateField)+1,0) AND even tried to hard code DateSerial
(2005,12,12)...still got 1/31/2010!

What I doing something wrong? Thanks in advance...
 
J

Jeff Boyce

I can understand why you'd get 1/31/2010 for that first version -- you told
Access to return the 0'th day of the current month, which translates to the
last day of the previous month (i.e., 1/31/2010!).

If you put that in first, as the default value, then created a new record,
that record would use that default, and you'd see 1/31/2010.

If you then changed the formula/expression for the default value, that will
only affect any NEW records you add. Did you add any new records?

Where are you seeing "1/31/2010"? Only in the form, but never in the table
that underlies the form?

Is that textbox bound to a field in the table (or query)?

More info, please...

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.
 
K

KARL DEWEY

I had a wild thought - maybe the under lying field the textbox is bound to
has 1/31/2010 stored in the table.
 
J

John W. Vinson

I don't know what I am doing wrong but I am using DateSerial as a default in
a textbox and no matter what I keep getting 1/31/2010.

I have tried to put in anything just to get it to be something other than
1/31/2010...DateSerial(Year(Date()),Month(Date()),0) AND DateSerial(Year
(DateField), Month(DateField)+1,0) AND even tried to hard code DateSerial
(2005,12,12)...still got 1/31/2010!

What I doing something wrong? Thanks in advance...

I don't think there's anything wrong with your code, just your expectations!

That dateserial expression will cause any new record to have the last day of
the previous month entered (unless you overtype it).

What do you WANT the field to contain?
 

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

Similar Threads


Top