Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SET REFRESH setting in multi user environment

Status
Not open for further replies.

mstrcmtr

Programmer
Nov 14, 2007
103
PK
Currently using the following setting of Refresh command in multi user environment

SET REFRESH TO 5,3

SET REPROCESS TO 30 SECONDS

But facing problem of duplication in getting counter no for sale invoices because many user saving invoice at same time on the network

From VFP Help come to know about -1 setting

-1 Always read data from disk.

SET REFRESH TO 5, -1

What is the best setting to avoid duplication in Counter No in multi user environment
 
Setting REFRESH has got nothing to do with avoiding duplication of unique numbers such as invoice numbers.

What you need to do is to lock the file the contains the last invoice number. Do that immediately before you request the next invoice number. Then update the file, then unlock it.

Alternatively, add an ID field to your invoice table, and make it an autoincrementing integer. Then base your invoice number on that integer. In that case, you won't need to worry about keeping the number unique, as that will be handled internally. The downside is that you might get gaps in the numbering sequence (depending on how you handle deletions).

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Locking counter table before getting Counter No with Flock() and then unlock after getting and updating the counter table but still sometime counter no duplicate

tested this by running Form and

Form showing value from counter table e.g. 101

From command window use counter table and change the value with the help of browse to 650 and Ctrl+W then on form refresh the counter value
still showing 101 ?

Why Value on Form not changing according to current value which is 650 instead of 101

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top