I have created a new field in the G/L Register table, “Period Trans. No.” and need to populate it with a sequential number based on the posting date range (another new field)…
However, the code below is not doing it for me, I get one number for each date:
01/01/08 = 1
01/01/01 (next record) = 0 (not assigned a number).
Here is my code. “Period Trans. No.” is assigned a value of 1 before processing;
Again I think it’s the SETRANGE on the posting date. This should be in the OnPreDataItem trigger otherwise it will get the first record of the table and then set the posting date range.
When running the report, it is possible to enter a date range such as 01/01/08…31/12/08.
In this example, I have tried entering a date range (or daterange) but that did not make any difference to entering the Date variables, PeriodStart and PeriodEnd.
Then it must be the key - I added a key for posting date only - Is yours Posting date and Period Trans. No.?
This would make sense as when you modify with a number then the position in the table is altered and the next record is the next date and Period Trans. No.= 0
You have extended your Register table with a “Posting Date” field. In this field you store the posting date of the General Journal.
How do you prevent the user from entering different posting dates in a General Journal?
How do you prevent the user from entering a posting date for the period between start and ending date AFTEr you have assigned your Period Trans. No.?
Dave’s report example should definitely work for you and do what you asked for.