Hi,
I created a form and sub form using employer and employee tables. On the form I have five variables that I want to pass to the function on the sub form.
Example:
Main Form Variables:
EmployerNo, Received Date, Receipt No. and Amount;. Now I want to populate a temp table with these variables and run the form using the function. Below is what I think the function would look like:
TmpItem.DELETEALL;
Employee.SETRANGE("Employer No.",EmployerNo);
IF Employee.FIND('-')
THEN REPEAT
EntryNo := EntryNo + 1;
TmpItem.ReceiptNo := "Receipt No.";
TmpItem.ReceivedDate := "Received Date";
TmpItem.Amount := Amount;
TmpItem."Entry No." := EntryNo;
TmpItem."Employee No." := Employee."No.";
TmpItem."Employer No." := Employee."Employer No.";
TmpItem.INSERT();
UNTIL Employee.NEXT=0;
I've run the above function without the variables as I don't know how to get them from main form to function in subform but the form closes when the function finishes running and data is inserted to the temp table.
NB I checked by using a real table instead of temp table.
Now my problems are:
1. How to pass these variables which are on the main form to the function in the subform.
2. Insert the data to temp table then run the form based on the temp table and then edit whatever I'd to edit and post the edited data to a real table called contributions.
Any ideas please!
Few years ago we were not existing and few years to come we would be in the grave! So what will benefit us in the grave?
Answers
you could set your variables like this
Then in your subform
MyFunction(EmployerNo: Code,ReceivedDate: Date,ReceiptNo: Code,Amount: Decimal)
your code comes here
Hope this gets you going
Albert
Try your code but it doesn't work. When I try to declare the function I got an error as the maximum length is only 30 character and when I declare the function as PopulateAut and then use an error pops up saying A maximum of 0 parameters should be used when calling the function...
Where am I get it wrong please!
I've solved the variable problem...Don't blame never taken a course or lecture on navision and microsfot documentation is real poor.
Now the other questions please...To run the form edit and then post to a real table.
Thanks.
RIS Plus, LLC