Solved

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

Posted on 2014-01-19
3
470 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying 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

Suggested Solutions

Title # Comments Views Activity
Query Dilema in Access 2010 3 40
managing events in  the webrowser control 14 66
Ranking Students in Ms Access based on given Criteria 5 61
Speed up Select Top n... Query 9 37
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Familiarize people with the process of utilizing SQL Server stored procedures 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 Micr…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…

752 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