weightinwildcat
Programmer
I have been working on an application for maintaining an inventory. One of the fields in the table has internal company part numbers. The field is a character field, but the entries are integers. The field is not a key field, by the way.
When a new record is added, I have a query run to get the maximum value. The code for calling this is as follows:
longValue = CurrentDb.OpenRecordSet(“SELECT MaxPartNumber from MaxPartNumber”).Collect(0)
The value placed in longValue is then incremented by adding 1, and the result is placed in the text box for the field in the main table.
The problem comes in when a person adds more than one record at a time. The query will run, but it gives me the previous maximum value for the part number. Does anybody have any thoughts on how to solve this problem?
When a new record is added, I have a query run to get the maximum value. The code for calling this is as follows:
longValue = CurrentDb.OpenRecordSet(“SELECT MaxPartNumber from MaxPartNumber”).Collect(0)
The value placed in longValue is then incremented by adding 1, and the result is placed in the text box for the field in the main table.
The problem comes in when a person adds more than one record at a time. The query will run, but it gives me the previous maximum value for the part number. Does anybody have any thoughts on how to solve this problem?