AccessDiscussion 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
Could you please help me with :
When I tried open recordset with ADO I got a message :
" You attempted to open a database that is already opened exclusively by user 'Admin' on machined 'mymachine'. Try again when the database is available". OS : Windows 98, Access 2000
But on Windows 2000, Access 2000 I have message :
"The database has been placed in a state by user 'Admin' on machinte 'my machine' that prevents it from being opened or locked"
The only form which is open doesn't have any subforms and doesn't open any other recordsets
Your database may have been closed improperly and it is now opened exclusively by the previous user (maybe you) if so, re-start the computer. Or you are opening the database exclusively by default, in that case, go to tools, options , advanced and make sure that your database default open mode is “shared”. If someone else has it opened exclusive, you will have to wait until that individual closes the database.
I tried to do that way before , I mean when I close database inside Access, than closed Access itself. And I checked if any ".ldb" file is opened, and I restarted computer as well, but .... no luck.
And in settings I have Open mode: "Shared", Record locking : " No Locks" , Open databases using record-level locking : "checked",
Enable DDE refresh: "checked", but again I got the same Message. :(
Form from which I run the code doesn't have any ADO connections
And I am the only one user of this database on stand along computer.
There is my code where I got the problem on opening first recordset
It's clumsy I know (I'm an amateur in databases :) )
First recordset I want to make Disconnected only because I need to open other recordset from the same table
Private Sub cmdInsert_Click()
Dim AptNum As String
Dim Rent As Currency
Dim Park As Currency
Dim Misc As Currency
Dim SQLPrevMonth As String
Dim SQLInsert As String
Dim PrevMonth As String
Dim MonthOfRent As Date
Dim PayDate As Date
Dim cnn1 As ADODB.Connection
Dim cnn2 As ADODB.Connection
Dim rs1 As ADODB.Recordset
Dim rs2 As ADODB.Recordset
'----------------make first disconnected recordset ----------------
On Error GoTo cnn1_Err
Set cnn1 = New ADODB.Connection
.Mode = adModeShareExclusive
.IsolationLevel = adXactIsolated
.Provider = "Microsoft.Jet.OLEDB.4.0;"
.Open "'C:\WINDOWS\Desktop\Super Office 1.77.mdb", "admin", ""
Set rs1 = New ADODB.Recordset
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockBatchOptimistic
.Open SQLPrevMonth, CurrentProject.Connection
Set .ActiveConnection = Nothing
Set cnn1 = Nothing
If Not cnn1 Is Nothing Then
Set cnn1 = Nothing
Do Until rs1.BOF
Actually all that code above is my try to insert a new record in the table which would repeat the same values in "Rent", "Park", "Misc" and insert Next "MonthOfRent".
Could you suggest better idea to overcome such logic
Thanks a lot for your help