Entering multiple records at once...

K

Kon

I have a table with names of employees. I would like to enter their salaries
every month but I want to list in a column the names and in a second column
next to each name the salary. I would like to avoid entering the names in a
combo box or something like that. I would like to enter data/salaries as in
a excel table with two columns and each row to be standard the name of the
employee. Something like this
Month : 7 Year : 2005
Employee
John 200
Jim 100
Mike 300
Then names I would like to apear again (3 rows when I enter again another
Month or Year.

I thank you in advance.
Kon
 
G

Guest

Here's one way.

Have the user enter the month in the form header. Let's call that box
SalaryMonthSelector. Make sure it is UNBOUND.
Put the EmployeID (or name), SalaryMonth (make this one invisible), and
salary in the detail section
In the RecordSource of the form (query view), draw records from the
SalaryMonths table using a criteria that filters to only those records where
SalaryMonth = [Forms]![YourForm]![SalaryMonthSelector]

After the user picks or enters the SalaryMonthSelector,

1. Make sure it is a new month

If DCount ("[EmployeeID]","[SalaryMonths]","[SalaryMonth] = '" &
[Forms]![YourForm]![SalaryMonthSelector] & "'") > 0 then Exit Sub

2. Append a set of records to the SalaryMonths table, one per active
employee: Employee ID (for all employees), SalaryMonth (set this equal to
SalaryMonthSelector), Salary blank

3. Requery the form, and it should now display the new records. If the user
had types an existing month into the SalaryMonthSelector, it would display
the contents of that month instead of appending a set of records with no
salaries entered.

You could even have it copy the salary from the prior month (using
DLookup/DMax) if most don't change from month to month.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top