Wrox Programmer Forums
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 4th, 2005, 12:22 PM
Registered User
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access VBA Question

I'm writing this here because the Access VBA category is locked.

I'm creating a database to track report information. I created an entry form and I'm trying to use ADO to open the database and add a new record to the table. I have upgraded to MDAC 2.8.

I'm receiving the following error when I try to open the database while I'm coding in it:

  The database has been placed in a state by use 'ADMIN' on machine 'SU-FX60074' that prevents it from being opened or locked.

The help in Access has nothing on this.

The code I'm using is as follows:

    Set cnObj = New ADODB.Connection
    Set rsObj = New ADODB.Recordset

    cnObj.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
               "Data Source=cnverrrptdesc.mdb;"

Old March 4th, 2005, 12:29 PM
Friend of Wrox
Join Date: Oct 2004
Posts: 564
Thanks: 0
Thanked 4 Times in 4 Posts

All this means is that someone else has the database open, and so it may create problems with the functions you are trying to run.

There is always a chance that this person might be you, and the operating system might not yet have cleared the lock. Look in the directory where the mdb file is kept, and see if there is an ldb file. The owner of this file is the person that has the database open. If the owner is you, ensure that you do not have the database open if you are connecting from outside the database. Alternatively, if you are trying to connect from within the database, try changing your Connection Open statement to set cnObj = Application.CurrentProject.Connection.

Hope that helps


Old March 4th, 2005, 12:53 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG

quote:Originally posted by vrocrider
 I'm writing this here because the Access VBA category is locked.
 No, it's not locked per se. There was a redundant area for VBA questions so the moderators locked one and kept the other one open. It's located here


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Old March 4th, 2005, 02:24 PM
Registered User
Join Date: Feb 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts

Thanks Mike. That did the trick.


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code works in Excel VBA but not Access VBA fossx Access VBA 2 May 21st, 2007 08:00 AM
Question on Access 2003 VBA Chapter 5 AlexJChang BOOK: Beginning Access 2003 VBA 1 June 7th, 2005 02:04 PM
Question on Access 2003 VBA - Ch5ExampleCode AlexJChang Access 2 June 3rd, 2005 11:10 AM
Access VBA - SQL question. Raelz Access VBA 4 February 10th, 2004 11:28 PM
Access XP VBA compatibility issues w/ Access 2000 bourgeois02 Access VBA 1 August 19th, 2003 04:14 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.