Macro in Access 2007 to setvalues on a from with values from another form - TechRepublic
Question
September 8, 2014 at 09:00 PM
betmck

Macro in Access 2007 to setvalues on a from with values from another form

by betmck . Updated 11 years, 9 months ago

I have a form call [Calculate Gross Pay] which record source is a query call [Gross pay].
Also there is a form call [Payroll] which fields are bound to a table called [payroll].

There are several records on the form[Calculate Gross Pay] and I need all records to be stored in the fields on the form [Payroll].
When I run the macro to populate the records, only the first record is displayed on the [Payroll] form. How do I repeat the Macro until all the records are read?

Macro:
OpenQuery Gross Pay, Datasheet, Edit
OpenForm Calculate Gross Pay, Datasheet, ,,Edit, Normal
OpenForm Payroll, Datasheet, , , Edit, Normal
SetValue [Forms]![Payroll]![PCdate], [Forms]![Calculate Gross Pay]![PayRegDate]
SetValue [Forms]![Payroll]![PCEmp], [Forms]![Calculate Gross Pay]![PrEmpName]
SetValue [Forms]![Payroll]![ PCNISB], [Forms]![Calculate Gross Pay]![ nisb]
SetValue [Forms]![Payroll]![PCNISD], [Forms]![Calculate Gross Pay]![ NISD]
SetValue [Forms]![Payroll]![PCpaye], [Forms]![Calculate Gross Pay]![ PAYE]
GoToRecord Form, Calculate Gross Pay, Next,

This discussion is locked

All Comments