I had a similar thought about adding the AutoNumber field.
If you'd rather not do that - you can create a separate Table - Pallet_Number_Table - and just put one field in it - Pallet_Number [data type Number].
Put a number into the Table. When I tested the code - I put the number 10000 in.
Create a Query to be the data source for your report - pull in all the fields you need on your Pallet report and then add a field to the query like this:
Code:
New_Pallet_Number: DMax("Pallet_Number", "Pallet_Number_Table") + 1
This will give you a number that is one higher than the number currently in your Pallet_Number_Table.
Then - behind your command button - you could have VBA Code like this to increment the number in your Table after you have printed your pallet report - so that the next time - the pallet number report will be one higher:
Code:
Dim db As Object
Dim rst As Object
Dim intPallet_Number As Long
intPallet_Number = DMax("Pallet_Number", "Pallet_Number_Table") + 1
Set db = CurrentDb
Set rst = db.OpenRecordset("Pallet_Number_Table")
rst.Edit
rst("Pallet_Number").Value = intPallet_Number
rst.Update
After this code Runs - the Number in your Pallet_Number_Table is the same as the number on your last Pallet Report - so that it is ready to be incremented for the next Pallet_Number.
I hope this helps.