Solved

How use date field to automatically populate 4 other fields

Posted on 2013-11-07
1
355 Views
Last Modified: 2013-11-07
On a form I have a date field... txtInvDate   After the user has entered a date in this field (short date format), I would like 4 other fields to automatically populate. They are:

(using for example 12/5/13 as the date entered in txtInvDate)

txtInvMonth (should populate with 12)
txtInvYear (should populate with 2013)
txtInvQuarter (should populate with 4 since December is in the 4th quarter)
txtFinancialyear (should populate with 2013)

What would the code be for the afterupdate event of txtInvDate ?

--Steve
0
Comment
Question by:SteveL13
1 Comment
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39631256
Me.txtInvMonth  = DatePart("m",Me.txtInvDate)
Me.txtInvYear = DatePart("yyyy",Me.txtInvDate)
Me.txtInvQuarter = DatePart("q",Me.txtInvDate)
Me.txtFinancialyear = DatePart("yyyy",Me.txtInvDate)

Jim.
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
It took me quite some time to sort out all the different properties of combo and list boxes available from Visual Basic at run-time. Not that the documentation is lacking: the help pages are quite thorough and well written. The problem was rather wh…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
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…

920 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

15 Experts available now in Live!

Get 1:1 Help Now