Month Year Date Format

B

Bryan Hughes

I need help! I have been working with ASP.NET and .NET win forms, and have
not worked in Access for awhile, so Access coding is very rusty.

I have a access 2003 db that someone else created, that needs a quick fix.

There is a a main form and tabs with subforms. There are date fields on the
subforms. On one of the date fields it looks like they have it storing just
the month and year (no day) in the table. On the subform, from what I can
tell someone changed from a textbox to a combobox. I need to change it back
to a textbox with input mask. I have the input mask as 99/0000;0;_, but
when it shows the dates entered it is showing them with day also (Access
2007 is auto adding the day date as 1). This is just on the subform view,
in the table it is stored correctly.

How can I set for input/view so the date entered stays as M/yyyy and not
auto defualt to M/1/yyyy?

Thanks for the help
Bryan
 
J

John W. Vinson

I need help! I have been working with ASP.NET and .NET win forms, and have
not worked in Access for awhile, so Access coding is very rusty.

I have a access 2003 db that someone else created, that needs a quick fix.

There is a a main form and tabs with subforms. There are date fields on the
subforms. On one of the date fields it looks like they have it storing just
the month and year (no day) in the table. On the subform, from what I can
tell someone changed from a textbox to a combobox. I need to change it back
to a textbox with input mask. I have the input mask as 99/0000;0;_, but
when it shows the dates entered it is showing them with day also (Access
2007 is auto adding the day date as 1). This is just on the subform view,
in the table it is stored correctly.

How can I set for input/view so the date entered stays as M/yyyy and not
auto defualt to M/1/yyyy?

Thanks for the help
Bryan

What's the datatype of the table field? If it's Date/Time then you CANNOT
store just the year and month; a date is stored as a Double Float count of
days and fractions of a day since 12/30/1899, and as such must be a complete
date.

John W. Vinson [MVP]
 
B

Bryan Hughes

Thanks John,

Yes they have it as a date/time field. I was not sure if Access handled
dates differently then VB.NET or SQL.

I got it to work, the formating an the textbox was set to shortdate, instead
of m/yyyy format. Changed that and it works fine.

Bryan
 
J

John W. Vinson

I got it to work, the formating an the textbox was set to shortdate, instead
of m/yyyy format. Changed that and it works fine.

You can certainly use a m/yyyy format for display purposes; as you've seen you
do need to do some trickery for data entry, and the date (regardless of how
it's displayed) will still contain a day portion.

John W. Vinson [MVP]
 

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