Solved

How populate form field with month name

Posted on 2013-12-03
3
428 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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Introduction When developing Access applications, often we need to know whether an object exists.  This article presents a quick and reliable routine to determine if an object exists without that object being opened. If you wanted to inspect/ite…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

746 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now