I have a data entry form which, every time it is started by a user, needs a unique session number. For this I included a procedure that opens a separate xls file (numbers.xls), in which the unique numbers are stored. Every time my form starts up, numbers.xls is openened, and a new, unique number is issued for the session. This new number is the highest existing number in numbers.xls, raised by1. This new highest number is then stored in numbers.xls, afther which numbers.xls is saved and closed.
The problem occurs when different users start up the form at the more or less the same time: the second one to open the form, actually opens a copy of the xls file, so that both users have the same session number (I noticed that the second user does get the 'file will be opened as read only' message, but it appears behind the form).
How can I ensure that a new number is not issued befor the previous user has closed and saved the file? (or provide the users with a unique session number in another way) ?
greetings from jurjen
Bookmarks