Problem in my Application-VBForums
Results 1 to 23 of 23

Thread: Problem in my Application

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Problem in my Application

    it is a first time i post question in any site , i need a fast help

    i made a Application by VB6 and use ADO in a small company that has 10 computers Windows XP , my Database is Access mdb file my Application works well but in one device i receive an error
    <<The Microsoft Office Access database engine cannot open or write to the file ''. It is already opened exclusively by another user, or you need permission to view and write its data >> it appears randomly in a computer not a specific computer

  2. #2
    PowerPoster TysonLPrice's Avatar
    Join Date
    Sep 2002
    Location
    Columbus, Ohio
    Posts
    2,789

    Re: Problem in my Application

    That sounds like locking and concurrency issues. I think you need to determine where it is happening and where, maybe two people trying to update the same table at the same time, and then go from there. No one can offer a solution until you determine that. I'm in a MS SQL environment and traces and logging could find that. I don't know about Access.
    In order to understand recursion, one must first understand recursion….

  3. #3

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Thanks TysonlPrice For Replied I use ADO and my code like that
    rsCustomer.Open "Customers", CN, adOpenDynamic, adLockOptimistic
    ADo can manage that issue even when 2 person update the same Record , i have to receive another error
    but this message prevent the user from opening the application

  4. #4
    Fanatic Member
    Join Date
    Dec 2008
    Posts
    880

    Re: Problem in my Application

    Are you using binding, Data Controls, Data Environment etc ?
    Are you maintaining connections to the DB, or do you do what I do -
    - Pure ADO code (no binding, etc)
    - Connect, get data, and disconnect the RS immediately.
    - Use Action updates (rather than rs) to insert, modify, delete records

    The more information you give us, the quicker you will get a solution

  5. #5
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    11,629

    Re: Problem in my Application

    Is there a chance that someone has opened the database with Access first?
    If memory serves some versions of Access will try to open the database for exclusive access by default and if that be the case other apps can not access it while it is opened in this manner.

    I seem to remember there being a setting for this in Access but it has been a long time since I encountered this so can't remember where the setting would be. I also think it may have changed on later versions but am not sure.

    Aside from that is there any place in your app where you open a connection for exclusive access?

  6. #6

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Thanks All i am very happy that persons give me a support and i do not know them, this is my first post in my life ,
    When the problem appears in a device i try to open a main computer that the database found on it i get message need to username and password <just i write administator and blank password then i get access the folder,
    i made workgroup by Windows XP and share the folder that contain the database and ADO path connection ,

  7. #7
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    5,781

    Re: Problem in my Application

    Per DataMiser: If memory serves some versions of Access will try to open the database for exclusive access by default and if that be the case other apps can not access it while it is opened in this manner.

    In the latest view versions of MS Access, one can have the database open, tables can be 'open' (that is viewable in Access), but, the table can not be id DESIGN Mode....it will hiccup every time. Like DM, I don't know if there is a setting to fix that, and like DM, I don't know if that is your issue or not....sounds more plausible that you have the table open in the VB, never closing it, and someone else tries to hit that table when their program start.

    Sammi

  8. #8
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    11,629

    Re: Problem in my Application

    It could also be that since you are using a networked folder that the user on the pc in question does not have write access to that location.

  9. #9

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    In order to solve My Problem , i think i can asked my question as ,i have a workgroup Computers nework Windows Xp how can i have a Shared Folder that Contain my database and All computers Can access it without any problem so all can connect to the Access database ,I made the folder share and Everyone have full control and all Computers Connect to the same workgroup
    Last edited by Hares; Jan 15th, 2017 at 04:01 PM.

  10. #10

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Need Help
    Actually i have about 15 Computers i XP and Win what shall i do to have a shared Folder and everyone can access it Without any problem at the time i see this problem in a device i can not access the folder , Please Help

    is there a maximum numbers of computers in workgroup network xp , or in access 2003

  11. #11
    PowerPoster SamOscarBrown's Avatar
    Join Date
    Aug 2012
    Location
    NC, USA
    Posts
    5,781

    Re: Problem in my Application

    You haven't answered the many questions posted to you...if you don't answer the questions, don't expect help simply by repeating your 'problem'..

  12. #12
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,091

    Re: Problem in my Application

    15 computers are trying to access a shared folder on an XP computer, using a simple work group.

    10 is the max. You need to use an actual server if you want to share to more than 10 people.

    http://superuser.com/questions/18129...-on-windows-xp
    Last edited by DEXWERX; Jan 23rd, 2017 at 07:04 AM.

  13. #13

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Sorry SamoscarBrwon , I do not Know what is DM And i close all of my RS when the user Close his Form , is ADO Support when multi users try to open the same table at the same time , What Should i do , this is the first Multi users Program
    '
    Thanks very much DEXWERK it is a very clear and Direct Answer ,if i use Windows 7 is that okey?, and if the number of users in Start workday is less than 10 although i received this error

  14. #14
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,091

    Re: Problem in my Application

    10 is still too many, given the connections may need to time out. Setup a file share on a Linux machine, or use Windows Server 2003 or better.
    You can't really expect MS to allow Workstation OS's to handle a file share. (Otherwise MS wouldn't be able to charge more for their Server OSs)

  15. #15
    PowerPoster
    Join Date
    Feb 2006
    Posts
    16,315

    Re: Problem in my Application

    You could also use a generic commercial NAS box. Just avoid the low-end consumer products.

    These start new around $300 USD without drives, but there are sometimes decent options in the used market as well. Expect to replace the drives in a used box if they come with it, but normally people pull those out.

    These are relatively trivial to administer in a workgroup LAN compared to fussing with a Windows or Linux server. They usually offer a simple web-based administration GUI. People use them with no Linux knowledge at all.

  16. #16
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    2,318

    Re: Problem in my Application

    Quote Originally Posted by dilettante View Post
    You could also use a generic commercial NAS box.
    Synology. All my clients have big file servers, but I've got a 7TB Synology NAS box at home and I absolutely love it. I believe mine was in the $600 to $700 range. Nice software RAID and it just works flawlessly, and I love the browser-based interface.

    I had an old Windows-Home-Server before that, but it kept giving me problems. Finally, the motherboard fried, and I was actually sort of happy. By plugging in the hard drives to other computers, I was able to recover everything. This Synology box is about a 5th of the footprint of the old WHS too.

    EDIT1: I don't even begin to use all the features of it, but I do use the cloud features. For instance, I'm in Houston right now on a job, while my NAS box is in Tennessee (my home). I've already logged into it a couple of times to grab files I have stored out there. It's nice having my own cloud.
    Last edited by Elroy; Jan 24th, 2017 at 06:50 PM.

  17. #17

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Thanks very much DEXWERK
    i installed Windows Server 2003 as domain Controller With Active Directory and i do not receive this message , but i have one problem when user update record i received an error
    << Can not update Currently Locked >>
    this message appears not all the times

  18. #18
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,091

    Re: Problem in my Application

    Easiest fix - Don't open recordsets with locks, unless you're going to make an update.
    And even then, just use a command to make the update.

    edit: The _best_ fix would be migrate the Database to SQL Server Express 2008 R2 (SP2).
    Use built in windows authentication to grant access to the database - per login, and you've got yourself a solid/reliable/industry standard solution.
    Last edited by DEXWERX; Apr 14th, 2017 at 07:02 AM.

  19. #19

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Thanks Fast Response From DEXWERK
    I use ADO 2.8 (VB6) i open RS like That
    rsLines.Open "Lines", CN, adOpenDynamic, adLockOptimistic
    can i open Recordset without locktype ? And How ?

    sorry if my question is stupid , i am not professional in this issue
    Last edited by Hares; Apr 16th, 2017 at 01:07 PM.

  20. #20
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,091

    Re: Problem in my Application

    This will open a read only recordset.
    Code:
    rsLines.Open "Lines", CN, adOpenStatic, adLockReadOnly
    Then use a command to make the update.
    Or open the specific record, make the update and close it to minimize the lifetime of the lock.

    Code:
    rsLines.Open "SELECT * FROM Lines WHERE ID=" & ID, CN, adOpenDynamic, adLockOptimistic
    If rsLines.RecordCount Then
        rsLines.Length = txtLength
        rsLines!Resistance = txtResistance
        rsLines!Reactance = txtReactance
        rsLines!Conductance = txtConductance
        rsLines!Susceptance = txtSusceptance
        rsLines.Update
        ' rsLines.Close
    End If
    rsLines.Close ' <-- DataMiser's Fix
    Last edited by DEXWERX; Apr 18th, 2017 at 08:33 AM.

  21. #21
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    11,629

    Re: Problem in my Application

    I would suggest to move the rs.close down below the end if so it closes the recordset even if the id is not found.

  22. #22

    Thread Starter
    New Member
    Join Date
    Jan 2017
    Posts
    9

    Re: Problem in my Application

    Thanks DEXWERK all of your answer helps me much , thanks DataMiser
    In Form Load Event i write <<rsLines.Open "Lines", CN, adOpenStatic, adLockReadOnly>>
    And in my SaveButton Click Event i use a command to make the update make the update and close
    1-is that You mean? And Should i close rs in start of Command Save button because rs is open Readonly as you mention
    2 if i use rs.close and rs.open for alot of time will it make a problem for example when some of users responsible of Addnew alot of record in a day ?

  23. #23
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    1,091

    Re: Problem in my Application

    Quote Originally Posted by Hares View Post
    Thanks DEXWERK all of your answer helps me much , thanks DataMiser
    In Form Load Event i write <<rsLines.Open "Lines", CN, adOpenStatic, adLockReadOnly>>
    And in my SaveButton Click Event i use a command to make the update make the update and close
    1-is that You mean? Yes
    And Should i close rs in start of Command Save button because rs is open Readonly as you mention No

    2 if i use rs.close and rs.open for alot of time will it make a problem for example when some of users responsible of Addnew alot of record in a day ?
    No
    good luck

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.