Default Values For Weekday and Month

  • Thread starter Thread starter Chinagroveh
  • Start date Start date
C

Chinagroveh

What are expressions to use in a form in fields bound to
a table that will display weeday name and month name base
on last date entered in a date field? What data type
should the weekday and month fields be in the table?

Thanks
 
Chinagroveh said:
What are expressions to use in a form in fields bound to
a table that will display weeday name and month name base
on last date entered in a date field? What data type
should the weekday and month fields be in the table?

If the date itself is stored in the table, the weekday and month names
should not be, because they can *always* be calculated from the date.
Storing them would introduce extra overhead while introducing the
possibility of inconsistency -- suppose the date is updated and the
weekday or month is not. What would you do if you came across such a
record?

Given a date, you can calculate the corresponding day name and month
name using the Format function. For the month name,

=Format([DateField], "mmmm")

For the day name,


=Format([DateField], "dddd")
 
Thank you very much! That makes my program much better.
-----Original Message-----
What are expressions to use in a form in fields bound to
a table that will display weeday name and month name base
on last date entered in a date field? What data type
should the weekday and month fields be in the table?

If the date itself is stored in the table, the weekday and month names
should not be, because they can *always* be calculated from the date.
Storing them would introduce extra overhead while introducing the
possibility of inconsistency -- suppose the date is updated and the
weekday or month is not. What would you do if you came across such a
record?

Given a date, you can calculate the corresponding day name and month
name using the Format function. For the month name,

=Format([DateField], "mmmm")

For the day name,


=Format([DateField], "dddd")

--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


.
 

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

Back
Top