muliple users - issue unique session number
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 -- jurjen ------------------------------------------------------------------------ jurjen's Profile: http://www.excelforum.com/member.php...o&userid=26919 View this thread: http://www.excelforum.com/showthread...hreadid=401413 |
muliple users - issue unique session number
Test the read-only property of the workbook, and loop closing and opening
until False. -- HTH RP (remove nothere from the email address if mailing direct) "jurjen" wrote in message ... 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 -- jurjen ------------------------------------------------------------------------ jurjen's Profile: http://www.excelforum.com/member.php...o&userid=26919 View this thread: http://www.excelforum.com/showthread...hreadid=401413 |
muliple users - issue unique session number
thanks! The read-only check is what I needed cheers, jurjen -- jurjen ------------------------------------------------------------------------ jurjen's Profile: http://www.excelforum.com/member.php...o&userid=26919 View this thread: http://www.excelforum.com/showthread...hreadid=401413 |
All times are GMT +1. The time now is 05:19 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com