Solved

Text box auto populate based on combo box in Access 2007

Posted on 2014-09-03
1
473 Views
Last Modified: 2014-09-08
So it has been a while since I worked in Access so I am very rusty. Here is the scenario:

Employee table with your basic data - fname, lname, empid, payrate and some others
Time entry table that has several fields including empid and payrate.

In the time entry form I have a combo box that is populated by a query allowing you to choose the employee you will be entering time for.

My problem - When I choose the employee I want the payrate text box to auto-populate with the payrate from the employee table. That information will in turn be placed in the payrate field of the time entry table.

Before you ask - Yes the payrate will be included in both tables but I want to be able to record in the time entry table how much they were being paid at the time of the entry.

Thanks in advance for any help.
0
Comment
Question by:princeservice
1 Comment
 
LVL 34

Accepted Solution

by:
PatHartman earned 500 total points
Comment Utility
If the payrate is associated with an employee, then include the payrate in the query used to populate the combo (don't forget to update the column count and column widths after you add the new column).  Then in the AfterUpdate event of the combo -

Me.txtPayRate = Me.CboEmployee.Column(2)

The columns of a combo are a zero-based array.  So .Column(2) is referring to the third column.  I assumed -
EmpID, EmpName, PayRate were the three columns.  Adjust the column number accordingly if you have more than three columns.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.

762 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

6 Experts available now in Live!

Get 1:1 Help Now