Attachment locking the entire DB !!! (1 Viewer)

elyamani

New member
Local time
Yesterday, 16:20
Joined
Jan 4, 2013
Messages
4
Hay guys
I just need help
i have access BD and every one use it through shared folder
my problem is in attachment ! , if i use the regular attachment filed in access there is one user only able to attach files and others can`t attach any thing until he finish
i tried to do attachment through VBA like below which make it worse as it lock the DB so, no one can even open the DB and one user only access the DB



Dim db As DAO.Database
Dim rsParent As DAO.Recordset2
Dim rsChild As DAO.Recordset2



Set db = CurrentDb
Set rsParent = me.Recordset
rsParent.MoveLast

rsParent.Edit

Set rsChild = rsParent.Fields("Attachment").Value

rsChild.AddNew
rsChild.Fields("FileData").LoadFromFile "file path"

rsChild.Update
rsParent.Update

Set rsChild = Nothing
Set rsParent = Nothing
end sub


appreciate your help how multi users attach files at the same time without locking the DB
 

missinglinq

AWF VIP
Local time
Yesterday, 19:20
Joined
Jun 20, 2003
Messages
6,423
...i have access BD and every one use it through shared folder...

If you're saying that you have a multi-user database that is not split into a Front End/Back End configuration, and all users are accessing it using a single file on a shared drive, your first order of business is to split the database!

Having multiple users sharing a single, non-split database, sitting on a network drive is the sure way to repeated episodes of corruption, speed and timing problems, and all manner of strange, odd and curious behavior, including the problem you're having, now! Multiple users simply have to work off of a split database, with each user having their own copy of the Front End, which contains everything except the data/tables, on their respective hard drives, and a Back End with only the Tables on a shared drive.

Being in forced retirement, I spend 8-10 hours a day here and on other Access forums/newsgroups, and over the past seven years have seen dozens and dozens of reports of non-split apps causing these kinds of problems as well as massive data lose! The really insidious thing is that a non-split app can work for extended periods of time before the troubles begin! But once it does, they become chronic, which is to say they occur over and over and over again!

The record, by the way, was a Non-Split db that had been working, without problems, for 12 years! It then started exhibiting all of the symptoms listed above and continued to do so until the app was split.
If your Database isn't really important, which is to say if data-loss isn't important, and the app being down won't cost you production time loss, then by all means leave it non-split.

Splitting an Access database isn't as scary as it sounds; Access will do most of the heavy-lifting for you! Here’s a tutorial on Splitting a Database:

http://www.hitechcoach.com/index.php?option=com_content&view=article&id=35:split-your-access-database-into-application-anddata&catid=24:design

Linq ;0)>
 

elyamani

New member
Local time
Yesterday, 16:20
Joined
Jan 4, 2013
Messages
4
Thank u very much for splitting idea but i already did that
the problem is i keep every things in shared drive cause i do lots of developing on the forms so, after i make the changes i replace the file and linking the table and if i ask every one to copy the file on his desktop and linked with tables DB it will be so hard for developing the forms and changes the codes as i have lots of users
please, if u have any ideas just tell me and i appreciated ur help .
 

cyberman55

Registered User.
Local time
Yesterday, 19:20
Joined
Sep 22, 2012
Messages
83
Hi, I suspect the record is being locked if a user is editing data - only one user at a time can edit a record without causing conflicts, so perhaps the solution would involve some type of timer function that saves the record automatically and "moves" the user to another record or "page". It's just a guess. By the way, with attachments, you'll find problems upgrading since you cannot simply append the data from one table to another if an attachment field is involved. I posted a solution to that problem on my website (informedcorp.com) - just go to the home page and then click the Access Developer's page link you'll see at the top of the page. It allows you to call the function with simply the names of the source and target tables (and, optionally, the name of the attachment field) and it does the rest of the work for you. See "move data", the second sample database down if you're interested. As a new user here, I can't upload the file to this forum (even zipped, the upload fails with a message about tokens - are you listening admin?).
 

Users who are viewing this thread

Top Bottom