I have a Purchase Order Request form that connects to a Microsoft Access database. The form walks thru the form ID numbers to find the latest number then adds one to that number and writes a new record to the database. This scripting works fine most of the time but very intermittently I get duplicate numbers. The problem seems to be due to the form being used at two buildings that are connected by a data line. When a user at both buildings create a new PO Request form at very close to the same time (within 3-15 seconds of each other), the duplicate form ID numbers result. I added script to check to make sure the form ID number is not already present before writing but I still have occassional duplicate numbers. The only fix I can think of is to add a prefix to the form ID numbers to indicate which building it originated from. I am open to any other suggestions.
How do I script to ignore the first letter (prefix - like T176) and search by the remaining numbers regardless of how many digets are involved?
while(!oDB.isEOF()){
if(xfa.record.DataConnection1.FileName.value > nMaxID)
nMaxID = Number(xfa.record.DataConnection1.FileName.value);
oDB.next();
}
Subform1.FileName.rawValue = (nMaxID + 1);
Thank you