Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
File in use/access denied
Message
 
To
17/05/2004 03:21:53
Neil Mc Donald
Cencom Systems P/L
The Sun, Australia
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00904473
Message ID:
00904531
Views:
19
>Hi,
>Check that the read only attributes aren't set on the exe or the data files.


>>ei!!! peace!!!
>>
>>i shared my program into a network, and it cannot access if another user using it. give me some tips on how to share it in multiuser and some sample codes on how to add new record or update a record in a network....
>>
>>thanks!!!

If a single user can update or insert a new record to your data

it means you created a single user.


You have to make it sure that you issue some commands using SET:
Set Exclusive off
If your tables are part of a DATABASE Container, be sure to open your

database in shared mode.


You can issue the command :
OPEN DATA <I>your_database_name</I> shared
This commands depends if you manually loading your data from your forms

Load Event Procedure

On My case, I Manually load my DATABASE and its table manually form by
form instead of opening on my main programs(prg..) like this:

I Mostly put under LOAD Procedure of my forms..
IF !DBUSED("MY_DATABASE_NAME")
         OPEN DATA DATA\MY_DATABASE_NAME SHARED
     ENDIF
     */* Open a table
     If USED("Customers")
        Select("Customers")
        Set Order to Tag "my_tag_name"
     ELSE
         Use customers in 0 order tag "my_tag_name" shared
     ENDIF
     SELECT("CUSTOMERS")
     GO TOP
Adding new Record, u can use Insert command, or append blank

Note: I used 3 Field on my sample, add according to your table fields.
SELECT("CUSTOMERS") && Change to your own Table Name..
APPEND BLANK   && YOU CAN ISSUE A RECORD LOCK OR CHECK TO TRAP ERROR WHEN
IF !ISRLOCKED()&& YOU & OTHER USERS APPEND RECORD AT THE SAME TIME
    RLOCK()   &&
    REPLACE FIELD_NAME1 WITH cVar1,;
        FIELD_NAME2 WITH cVar2,;
        FIELD_NAME3 WITH cVAR3
    UNLOCK
ENDIF


OR LOCK the record when you just appended a blank record.

You can LOCK the Whole Table if you prepare 1 user appending records at a time by issueing the command FLOCK, but dont forget to UNLOCK it to give access to other user.


Updating of Records,


You can use Update Into commands, or just use the replace command..
SELECT("CUSTOMERS") && Change to your own Table Name..
IF RLOCK() && IF you didn't issue Automatic Locking
    REPLACE FIELD_NAME1 WITH cVar1,;
        FIELD_NAME2 WITH cVar2,;
        FIELD_NAME3 WITH cVAR3
    UNLOCK
ELSE
 && IF CANNOT LOCK RECORDS
 && YOU HAVE TO INFORM THE USER WHATS GOING ON AND<BR>
 && IF YOU DIDN'T ISSUE <I>SET REPROCESS</I> nSECONDS
ENDIF
Hope you can get some a TIP... There's a lot of command you can use.. check on your VFP Help System and look for record locking.


By the way, if you Issue a record LOCK or FILE LOCK without unlocking can cause the message File in use/access denied.
Jojo R. dela Cuesta, B.Sc.
eConsultant, Programmer
Dalplus Technologies
http://www.dalplus.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform