Format in Form MM/YYYY

G

Guest

I am using access 97- trying to set up a form with default MM/YYYY format-
can't seem to use properties to use formats or input masks to accomplish
this. I have the following formula in the Control Source:

=Month(Now()) & "/" & Year(Now())

I would like the form field to display 10/2004 automatically. However, I
would like the user to have the ability to change the date if needed.

Thanks,
Nick
 
R

Rick Brandt

Ndel40 said:
I am using access 97- trying to set up a form with default MM/YYYY format-
can't seem to use properties to use formats or input masks to accomplish
this. I have the following formula in the Control Source:

=Month(Now()) & "/" & Year(Now())

I would like the form field to display 10/2004 automatically. However, I
would like the user to have the ability to change the date if needed.

1)
A control can either be bound and edited by the user or contain an
expression. It cannot do both.

2)
10/2004 is NOT a date and cannot be stored in a Date field. You can store
a date that includes a day, month, and year and then use the format
property to not show the day, but when making entries all three have to be
included has to be included. Otherwise you need to use a Text field
instead.
 
S

Steve Schapel

Nick,

Just as a follow-on to Rick's spot-on advice... You can use the Default
Value property of the control on the form, with the expression:
Month(Date()) & "/" & Year(Date())
.... to get the control to automatically show 11/2004 for a new record,
and this would then be editable by the user.
However, depending on the meaning of this field, and what you need to do
with it, it may also be "correct" to have the month component and the
year component as two separate fields.
 

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