Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 491
  • Last Modified:

Text box auto populate based on combo box in Access 2007

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
princeservice
Asked:
princeservice
1 Solution
 
PatHartmanCommented:
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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now