OK, so if I open the file as follws, then increment the counter and write the file back...
open "pathname" for input lockreadwrite as #1 input #1, intCount close #1 intCurrent = intCount intcount = intcount + 1 open "pathname" for output lockreadwrite as #2 print #2, intcount close #2 1) Would this be correct ? 2) Does this still not allow another program to access the file between the input and output operation ? 3) Can I open the file locked and perform both the read and write operation before closing the file ? Sorry if this is basics, have only ever done stand alone applications before without any filesharing. --- In [email protected], Matt <[EMAIL PROTECTED]> wrote: > check the read only attribute when you open the file, if it is not set > set it and open the file. If it is set, keep trying, or throw an > error. When you are done turn it off. > > Matt > > testblokepuma wrote: > > >I many label programs that all increment a counter on a server (simple > >text file) for the serial number part of the label. Problem is that > >two different PC's are managing to open the file at the same time, > >therefore I am getting duplicate serial numbers (big issue with customer). > >How can I get this counter file to restrict access to one user at a time. > >Help much appreciated. > > > >Kevin > > > > > > > > > > > > > > > >'// ======================================================= > > Rules : http://ReliableAnswers.com/List/Rules.asp > > Home : http://groups.yahoo.com/group/vbHelp/ > > ======================================================= > > Post : [email protected] > > Join : [EMAIL PROTECTED] > > Leave : [EMAIL PROTECTED] > >'// ======================================================= > > > >Yahoo! Groups Links > > > > > > > > > > > > > > > > > > ------------------------ Yahoo! Groups Sponsor --------------------~--> Fair play? Video games influencing politics. Click and talk back! http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/k7folB/TM --------------------------------------------------------------------~-> '// ======================================================= Rules : http://ReliableAnswers.com/List/Rules.asp Home : http://groups.yahoo.com/group/vbHelp/ ======================================================= Post : [email protected] Join : [EMAIL PROTECTED] Leave : [EMAIL PROTECTED] '// ======================================================= Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/vbhelp/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
