Solved

How populate form field with month name

Posted on 2013-12-03
3
431 Views
Last Modified: 2013-12-03
I have a field on a form that is a date field.  If the user, for example, enters 11/2/2013 in this field I want the month name (November) to automatically populate a second field on the form.



How can I do this?
0
Comment
Question by:SteveL13
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 500 total points
ID: 39692945
Try this in the After Update event of the first textbox:

Textbox2 = Format(Textbox1, "mmmm")
0
 
LVL 61

Expert Comment

by:mbizup
ID: 39692954
This has a sanity check to ensure that a valid date has been entered:


Textbox2 = iif(IsDate(TextBox1,  Format(Textbox1, "mmmm"), "")

Open in new window



And an alternative, assuming this is an unbound field (which it should be), you can set the Control Source property of the second TextBox to:

 = iif(IsDate(TextBox1,  Format(Textbox1, "mmmm"), "")
0
 
LVL 15

Expert Comment

by:JimFive
ID: 39692957
If this is for display purposes only then:
Set the control source for the second field to the same as the date field and set the format to mmmm
You will probably want to set the Enable property for the second field to No, also.

If you need the actual word in a new field to save it in a table then you need to set the code in the After Update property of the date field to
Me("MonthFieldName").value = Format(Me("DateFieldName"),"mmmm")
0

Featured Post

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question