Solved

How populate form field with month name

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

713 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