Solved

Text box auto populate based on combo box in Access 2007

Posted on 2014-09-03
1
479 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 35

Accepted Solution

by:
PatHartman earned 500 total points
ID: 40301696
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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
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…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

773 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