I have a list of firms in a parent table. For each firm, I need to track payrolls both by date and by number in a child table with some additional information. Would it be possible to auto populate the date and number fields each time you add a record and select the contractor? The payroll #s would go 1, 2, 3... the dates would be populated based on their start date and continue every 7 days.
- implement the image onload technique on the child table to respond to ?a=API_GenAddRecordForm
- grab the &_fid_7=1 parameter off the URL. This parameter will be automatically inserted if you click on the add Child button on the parent
- in script query the existing child records related to the parent record and extract the values for the date and number
- bump up the date by one week and increment the number by one and stuff these values into the appropriate field on the ?a=API_GenAddRecordForm page
You probably have a table of Contractors which has an embedded report of Payrolls. I suggest that you do a summary field of the maximum of the payroll #. Also a field for the maximum of the Payroll Date.
Then there is an existing button to Add Payroll, If you post that code and let me know the field ID numbers of the two fields to be updated I can help you. for example
URLRoot() & "db/" & [_DBID_PAYROLLS] & "?a=API_GenAddRecordForm&_fid_10=" & URLEncode ([Related Contractor])
& "&_fid_99=" & ToText([Maximum Payroll #] +1)
& "&_fid_100=" & ToText([Maximum Payroll date] + Days(7))
& "&z=" & Rurl()
In the example above the field ID's for the two fields to be populated are 99 and 100
I am a bit behind schedule at the moment but I will put this on my "techniques to implement" list.
Just pulling your chains Mark. If you understand Mark's methods you will see that there is often a high degree of duality between native and script solutions.