Solved

How populate two field on a form using data entered in 1st field

Posted on 2014-01-19
3
448 Views
Last Modified: 2014-01-19
I have three fields on a form.

Field #1 is a combobox from which a user can select a year.  For example, "2013"

Fields #2 and #3 are fields which I want to populate on the afterupdate event of field #1.

If the user selected 2013 from field #1, I want field #2 to populate with "7/1/2013"  (It will always be July 1st).

and

If the user selected 2013 from field #1, I want field #3 to populate with "6/30/2014"  (one year after field #2).

How can this be done?
0
Comment
Question by:SteveL13
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39792287
place the codes in the afterupdate event of the combo

me.field2=dateserial(me.field1,7,1)

me.field3=dateserial(me.field1+1,7,0)
0
 

Author Closing Comment

by:SteveL13
ID: 39792311
Perfect!  Thanks again.
0
 
LVL 65

Expert Comment

by:Jim Horn
ID: 39792312
The above answer is correct.  Also, what I typically see is if a business has years that follow certain logic, such as 7/1/XX to 6/30/XX + 1, then there should be a table that stores all of these values, such that any year logic can use the table without having to recalculate it every time.

Or in the case of this combo box, bring along for the combo box row list the two date columns, then in VBA the Combo Box's AfterUpdate event can just do a

Me.SomeTextBox = Me.MyComboBox.Column(x-1), where x is the ordinal position of the row, meaning if StartDate is the 5th row then a 4 would go here.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
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…
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…

758 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

24 Experts available now in Live!

Get 1:1 Help Now