Set Value Macro

YNWA

Registered User.
Local time
Today, 05:51
Joined
Jun 2, 2009
Messages
905
Hi, I have created this macro to calculate form fields and store the value in the relvant table.

My form consists of 1 form and 1 sub form. The Marco currently runs in the subform and works when opening the subform only. It sotes the data as planned and into the right table.

The fields are Rate of Pay * Hours Worked + Mileage Claim to give me a Total Claim.

The values I have in the macro are

Item: [Total Claim]

Expression: CCur([Rate of Pay]*[Hours Worked])+[Forms]![Table2 subform]![Mileage Claim]

I have the macro saved in the OnCurrent event of the subform and also in the AfterUpdate events in teh Rate of Pay, Hours Worked and Mileage Claim fields in the sub form.

But when I open my main form up, I get the error...

"Microsoft Office Access can't find the form 'Table2 subform' referred to in a macro expression or VB code"

My main form contains 2 fields Staff Code and Surname, the subform then allows me to enter hours worked, total claim etc... multiple times into the subform. Like an employess working times etc...

Any one know what I need to change to get this to run correctly?

Thanks
Will
 
Hi, I know have this working for the main form.

I changed the macro around and entered ...

CCur([Forms]![Table1]![Table2 subform].[Form]![Rate of Pay]*[Hours Worked])+[Mileage Claim]

As my expression.

However, when I enter records via the form, I need to click the "next" arrow on the form to make it save the final total. It is not saving it on its on as I go along.

Also when I create a record, it is entering data into the table but nothing has been entered into the form. Some fields do stat with defautl values of 0, but when I then proceed to enter data, it saves the data under a new line in the database with the staffID assigned to it.

Any help?
 

Users who are viewing this thread

Back
Top Bottom