Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Duplicate numbers
Message
From
16/03/2010 22:24:23
 
 
To
16/03/2010 17:53:15
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
Visual FoxPro:
VFP 8 SP1
Miscellaneous
Thread ID:
01454921
Message ID:
01454989
Views:
34
Hi Greg, thank you for your reply. I can not lock the whole table because it is used for other things. But I tried to lock the record and pass the next barcode number but on occasions, the number was duplicated if two operators where working on the system. When I closed and open the table, plus the rlock(), it seems to behave and I haven't seen any duplicates yet. Here is my modified code :
IF USED("barcno")
	USE IN barcno
ENDIF
IF NOT USED("barcno")
	SELECT 0
	USE barcno
endif		
select barcno 

nBarc=barcno.barcno  
IF nBarc <= 0
	MESSAGEBOX("This computer is not setup with barcode numbers","")
	RETURN
ENDIF 
IF RLOCK('barcno')	
	replace barcno with nBarc+1
	UNLOCK
else 
       MESSAGEBOX("The barcodes numbering file is in use, plese try again","")
	RETURN
ENDIF 	
FLUSH in barcno force
IF USED("barcno")
	USE IN barcno
ENDIF
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform