Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


SET REFRESH setting in multi user environment

SET REFRESH setting in multi user environment

SET REFRESH setting in multi user environment

Currently using the following setting of Refresh command in multi user environment



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.


What is the best setting to avoid duplication in Counter No in multi user environment

RE: SET REFRESH setting 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 Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads

RE: SET REFRESH setting in multi user environment

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close