Maximum isn't working

This has always worked but isn’t in Pan X for some reason. I have a file of Standing Orders as my customers get the same products twice a week with maybe different quantities. In a procedure to load the Standing Orders, I use the Maximum statement to get the last (largest) invoice number in the Orders file which is in a summary record at the end of the file. I select the summary record, copy the invoice number to a variable, import the Standing Orders and formula fill the Invoice Number field with variable+Invoice Number. the Maximum statement is not working in the procedure. When I open the Orders Data Sheet and select Maximum from the Menu, it does’t work the first time but does on the second attempt. I sent Jim a copy of my Orders File so he can check this out.

Other customers have used the Maximum statement over the past 9 years, it definitely does work. Sometimes people have problems because they don’t realize the database already has a summary record in it. This can be especially confusing if the summary record is not currently selected.

In any case, for your application I would suggest that the Maximum statement is no longer the best solution. Instead, use the aggregate( function. This can calculate sums, averages, max and min without having to create a temporary summary record.

With this function you can calculate the maximum and load it into a variable in a single statement.