Hi, i am trying to get a latest salary figure to be shown in a text field on a parent form, sourced from a sub form.
But with the criteria that it is only for that employee number and that a checkbox indicating that it is the lastest salary has been checked. Here is the VB code I have used
Salary = DLookup("[AnnualNetSalary]", "TalbotTestRole", "[Employee Number]" = Forms!TalbotTestFormPersonalRecords!TalbotTestSubf orm![Employee Number] _
& "[LatestSalary]"" = Forms!TalbotTestFormPersonalRecords!TalbotTestSubf orm![LatestSalary] =" & True)
So, for example, I have two records in my database for John Smith and Tim Ball. Through the year 2008/2009 both have had two roles, where the salary has changed (these are subform records.
Although both salaries are recorded in the subform, on the parent form I only want to show the latest salary figure. To do this, I have a 'Latest Salary' checkbox in the sub form next to the salary field.
So, by clicking the checkbox, the main parent form record for John or Tim will show thier latest salaries.
Thats what I am trying to acheive with the Dlookup code.
Cant quite get it. Can anyone help? Its driving me mad!
thanks
marc