Date format

C

Corinne

I should like to be able to put a date on a form (manually) as the format
'Jan 03' or whatever date I chose. In the format property of the field I
have put 'mmm yy'. When I type in 01/03 I get March 04 returned, whereas I
should like Jan 03. If I type 01/01/03 then I get Jan 03. but I don't need
the day just the month and year.

Can anybody help here please.
Many thanks
 
T

Tim Ferguson

I should like to be able to put a date on a form (manually) as the
format 'Jan 03' or whatever date I chose.
....

If I type 01/01/03 then I get
Jan 03. but I don't need the day just the month and year.

Well, January 2003 is not a date: it's a range of dates. The VB DateTime
variable refers to a point in time that lasts a fraction of a second, and
you just cannot make it into something else.

You can pretend a "dummy" day value, so that all your dates refer to the
fifteenth of the month, or the first, or whatever.

You are probably better advised to use a text field, but it's probably a
good idea to format it so that at least it sorts right -- for example, as a
"yyyy-mm". You have very definite validation problems, though.

Some uses will require you to have two separate fields for the year and for
the month. It makes validation easier as well as sorting and most maths, if
you need that sort of thing.

But, basically, you don't want a DateTime.

Hope that helps


Tim F
 

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