Here's a concept:
Three Tables
1) Employees: same as yours
2) Payments:
PaymentID (Auto number)
EmployeeID (Number, Foriegn Key)
PaymentDate (Date)
PaymentYear (text 4 characters)
Payment (Currency)
3) Employee_Rates
EmployeeID (Number, foriegn key) combo key
EmployeeYear (Text 4 charachters) combo key
Rate (Currency)
Now, as for fixing the payment amount look up, you'll need
an unbound textbox for showing that year's amount
a combo box for selecting the year
you can put a value list in for the combo box of 4 digit years OR create a
Look up table with a list of years. For this example, call it "ComboYear"
now for the unbound textbox
=DLookup("[Employee_Rates]", "[Rate]", "[EmployeeID] = " & Me.EmployeeID & "
AND [EmployeeYear] = '" & Me.ComboYear & "'"
--
~Your Friend Chris
http://myvbastuff.blogspot.com/
thinking out loud
"Tray" wrote:
> I have a problem, which I'm sure should be easy to resolve - but I've spent
> so long looking at it that I just can't work it out now.
>
> Part of my database is to record payments made from different employers.
> Each employer pays an amount according to their individual rate (which
> changes each year).
>
> So far, I have setup 3 tables:
>
> Employer:
> employerRef (Primary Key)
> employerName
> employerType
>
> Payment:
> paymentID (Primary Key)
> employerRef (Foreign Key)
> paymentDate
> paymentAmount
>
> Rate:
> employerRef (Compound Key)
> paymentDate (Compound Key)
> rate
>
> Firstly, I'm not sure whether this was the best way to set it up (with the
> compound key in Rate). And I can't decide how the relationships between the
> Rate table and the others should be setup.
>
> When a user inputs a new payment, I want them to select the employerRef
> first and for the form to then display the employerName (for reference). This
> part I managed to do by binding the form to an autolookup query with the
> Employer and Payment tables.
>
> When the user then selects the paymentYear, I want the form to display the
> corresponding rate for that particular employer in that particular year. Any
> guidance for how I should do this? I've played around with queries but can't
> get it to work.
>