It is a point of sale system and they do not provide support for this kind of thing.
I've been monkeying around with this system for several years. We are upgrading to the latest version and they switched the back end from Access to SQL Server. I had this working in Access but this particular function doesn't work in Access now because the SQL Server table uses a bigint PK and Access can't handle that.
I'm trying to do this with a temporary table which does have an identity column. I created the following code.
DECLARE @MyCounter int;