Default Date in forms...


P

PsyberFox

Hi there,

I have the following problem - take into account that the normal date format
in my country is dd/mm/yyyy.

I have a date field in a form, with an input mask - this all works fine.
However, I had an after_update event procedure as follows:
Date.DefaultValue = Date
BUT, when going to the next record, it showed it as 00:00:22. THEN, I
changed the after_update event procedure to the following (to try and force
it to the format I need):
Date.DefaultValue = "#" & Day(Date) & "/" & Month(Date) & "/" &
Year(Date) & "#"
This all worked fine UNTIL yesterday 03/06/2008 - when going to the next
record, for some reason it changes on screen to 06/03/2008.

Can anyone please shed some light on my problem?!

Thank you and regards,
 
Ad

Advertisements

A

Albert D. Kallal

You don't need to use code, simply open the form in design mode, and put in
the date function as the default

eg:

=(Date())

I now idea why you need code, but, you would have to use:

Date.DefaultValue = "=(Date())"

If you *really* want to stuff in the default as a stirng, then you have to
go:

Date.DefaultValue = chr(34) & format(date,"dd/mm/yy") & chr(34)
Can anyone please shed some light on my problem?!

when you stuff in the date, it likey getting stored as a number...not a
formatted date value...

you should NOT need code if you simply put in

=(date())

By the way, having a control, or a field called date often confuses
ms-access code due to a function also called date
 
W

Wayne-I-M

Hi

You should not need to "force" the date to format. Go the control box -
regional settings - and change your country details.
Date.DefaultValue = Date
You should not have a field called "date"
me.controlname=Date
 
P

PsyberFox

Hi,

Thank you for this... exactly what I needed. I know the issue about reserved
names, etc... but the fields were named quite some time ago and it's now way
too late to start changing them, unfortunately!

Also, just to explain why I needed this - it was to put in the previously
used date so that users entering data don't need to put in dates the hole
time.
 
Ad

Advertisements

Ad

Advertisements


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