Tricky problem with dates

G.King

New member
Local time
Today, 07:11
Joined
Nov 12, 2011
Messages
5
I have a database where there is a requirement for the month to be generated automatically and then stored as text. That is to say, the dbase needs to determine that the current month is April and store the text value April in a text value field. Any ideas how I can do this please without resorting to a complicated coding solution? [as I don't code]

Help gratefully received from those more able than I.
 
Check out the VBA function MonthName().
 
This is going to be fun.

I have a database where there is a requirement for the month to be generated automatically

First, nothing is automatic. That goes for life as well as Access. Something has to trigger it to occur. What's that trigger?

Second, you don't store calculated values in a database, you calculate them. In this instance you would calculate them using the Month (http://www.techonthenet.com/access/functions/date/month.php) and
MonthName (http://www.techonthenet.com/access/functions/date/monthname.php) functions.
 
Thank you. I should have said that automatic meant when a new record is created it triggers [at present] the date to be generated as a default value Date() in a date\time field. I'd played around with Month() but haven't come across MonthName() before.

Thank you both. I believe I can figure from here.
 
Simply store the date the record is generated. Use Date() as the default value and lock the field to prevent data entry. Unless, you want the user to be able to actually enter a date, in which case, don't lock it.

Then when you need to display "April", use MonthName(yourdate) to extract it. It makes sense to store the date the record was created. It makes no sense to store a month name in addition or in place of.
 

Users who are viewing this thread

Back
Top Bottom