Ok,
This may be a stupid question, but are you able to change the table? I would add an autonumber field (if all your palletno values truly are sequential, and unique already). I would just add the autonumber as a new field in the table, add a text box for it on the form, set the visible property to false, and then On_Current do:
- If PalletNo_Text.value = "" then
-
PalletNo_Text.Value = YourNewAutoNumField.Value
-
End if
Either way, I'd think adding that autonumber field as a genuine unique index and primary key would help things in general.
Ideally you'd want to just get rid of the duplicate information, and rename the new autonumber field to PalletNo.