Page 1 of 2 12 LastLast
Results 1 to 15 of 25
  1. #1
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479

    Exclusive access error

    I've made a mistake somewhere and getting error "You do not have exclusive access to the database at this time. If you proceed to make changes, you may not be able to save them later."
    This is with all objects closed. (As well as trying to edit code)

    Is there any command to restore 'exclusive access'? There's no other user in reality.

    Or, is it possible to check in various procedures to see where the problem starts and hopefully what's causing it ?



    Thanks.

  2. #2
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    I'd start by looking at Task Manager (ctrl+shift+esc) to see if there is a copy that is not visible but is still loaded into memory. You must look at both the Apps and Background Processes list to be sure. If you find nothing, check the file properties in File Explorer. After that I might also try opening Access first, and then open the db rather than opening the db directly if that is what you do. Do nothing except File/Save and reopen and see if the issue persists.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    Thanks for replying... I couldn't find a 2nd Access in Task manager.
    After a bit of playing, seems i can make it error on will, so will work slowly through the code hoping to isolate the problem area.

  4. #4
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    Not sure if I've made much progress but the error occurs on line


    Set mp = Form_frmMain.subDisplay.Form.RecordsetClone

    Run—time error '3734':
    The database has been placed in a state by user 'Admin' on machine
    'WIN10—PC' that prevents it from being opened or locked.

    Mp has been Dimmed as DAO.Recordset.
    Nothing has caused this state intentionally.

  5. #5
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    any reason for using the recordsetclone which is read only? have you tried just using the recordset?

    and you need to clarify - you said
    This is with all objects closed.
    but your code is referring to an object that must be open
    Set mp = Form_frmMain.subDisplay.Form.RecordsetClone
    and why the 'Form_frmMain'? which is the method to refer to a forms vba code, usual construct is 'Forms.frmMain' and if the subform is in the same form as the code , just 'Me.'

    And as an aside you may not be able to reference a clone on another form (a subform is still another form)

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    CJ, why do you say recordsetclone is read-only? I can certainly edit data via recordsetclone.

    Also, I have no problem with code in one subform opening recordsetclone of another subform and editing its data. Middlemarch's syntax worked for me.

    Really don't have enough information to analyze issue.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    CJ, why do you say recordsetclone is read-only? I can certainly edit data via recordsetclone.
    see remarks in this link

    https://learn.microsoft.com/en-us/of...recordsetclone

    'This property is available only by using Visual Basic and is read-only in all views.'

    agree, not enough info - so just speculating - particularly the use of 'form_....' which is a visual basic construct for calling public functions in other forms, not an 'object' that can be assigned to another.

    Are you saying it works for you exactly as the OP has written (subject perhaps to a different form/subform) with form_...

    Wasn't aware the OP wanted to edit the data



  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    I don't know if OP wants to edit data. Only responding to your point about read-only. I stand corrected. RecordsetClone property is read-only. OP is setting a recordset object variable to recordsetclone dataset and that recordset object is editable.

    Yes, I tested with Form_ syntax.

    RecordsetClone is commonly used to search form's dataset for a record without form reflecting that search then set focus to a record on form using Bookmarks only if match is located.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,934
    Yes, I tested with Form_ syntax.
    new one on me

    RecordsetClone is commonly used to search form's dataset for a record without form reflecting that search
    I know - but you don't normally assign it to another object

    OP still not clarified if the form is actually open or not - I presume in your test it was open?

  10. #10
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    See explanation in https://accessexperts.com/blog/2011/...ecordsetclone/

    It's not necessary to assign to a recordset object variable but works.
    I would probably just use With Me.RecordsetClone.

    Yes, form was open.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  11. #11
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    Understood the question could have been better, but it's a bit hard to describe what's happening with an unhelpful error you can't trap.
    E.g. It can occur just when typing some code in while stepping/debugging.
    Is there no way to see how many users access thinks it has? If there is I could find and check why at the point it changes.

  12. #12
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The lock file can show how many connections are using backend.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  13. #13
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,423
    If the db is not split, then the lock file to look at would be the db itself? We should first know if this db is split or not.
    There are also these reasons

    The Compact On Close database setting is selected.
    The Track name AutoCorrect info and Perform name AutoCorrect database settings are both selected.
    The form or report object you’re trying to open contains an embedded macro within a control or form event.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  14. #14
    davegri's Avatar
    davegri is online now Excess Access
    Windows 11 Access 2019
    Join Date
    May 2012
    Location
    Denver
    Posts
    3,741
    E.g. It can occur just when typing some code in while stepping/debugging.
    Do you have a timer event running on an open form when this happens?

  15. #15
    Middlemarch is offline Competent Performer
    Windows 10 Access 2019
    Join Date
    Mar 2015
    Posts
    479
    I appreciate very much everyone's comments. After 3 or 4 days I'm no closer to figuring out what I've done wrong.
    So I've made a cut down version of the db to demonstrate the error.
    It's invoked by


    Run listtest
    Open frmMain
    Click Import
    Chick the "Other' button
    Select the combo dropdown
    Check some items
    Click Action


    It should stop in Private Sub btnImport_Click().
    After which you often cannot type into the editor withing getting the error.
    Somtimes too, it would stop three lines above Stop on Set EXTDB =...


    Then any attempt to Save or do anything else causes the error. I can only move on from this by saying No to the save prompt then a compact and repair. Of course the same things repeat when next run.
    Microsoft Access can't save design changes or save to a new database object because another user has the file open. To save your design changes or to save to a new object, you must have exclusive access to the file.


    Apologies for the lack of comments in the code, and it's amatuerishness. it's purpose it to copy selectable fields from another db into the current record.
    Everything needed is in the zip file.
    Listtest.accdb
    mp3ListBEmdb
    OList_BE.mdb
    Attached Files Attached Files

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 11
    Last Post: 09-10-2019, 03:10 PM
  2. Replies: 6
    Last Post: 08-08-2016, 06:42 AM
  3. Replies: 3
    Last Post: 06-10-2016, 06:07 AM
  4. Replies: 4
    Last Post: 01-15-2014, 01:00 PM
  5. Replies: 6
    Last Post: 11-15-2013, 07:01 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums