Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Text box auto populate based on combo box in Access 2007

Posted on 2014-09-03
1
Medium Priority
?
490 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
[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
1 Comment
 
LVL 39

Accepted Solution

by:
PatHartman earned 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

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.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

670 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