PC Review


Reply
Thread Tools Rate Thread

DB Open Error

 
 
=?Utf-8?B?RWRkaWUncyBCYWtlcnkgYW5kIENhZmUn?=
Guest
Posts: n/a
 
      9th Mar 2005
Hi, when I switch between “Design View” and “Form View”, I get the following
error.

Run-Time Error …. “The database has been placed in a state by user ‘Admin’
on machine … that prevents if from being opened or locked.”

I am opening a table and putting its data into collection objects that are
passed back to the caller. The Bug has been giving me troubles for some time.

The error is occurring at line number 26 (conn.Open strConn). If you have
any suggestions they would be greatly appreciated.

1) Public Sub Read_DBTable (ByVal tblName as String, _
2) ByVal dbName as String, _
3) ByRef myCollection as Collection)
4)
5) Dim conn As ADODB.Connection
6) Dim rs As ADODB.recordSet
7) Dim tmpSQLstr As String
8) Dim strConn As String
9) Dim NumOfRows as Integer
10)
11) tmpSQLstr = "SELECT "
12) tmpSQLstr = tmpSQLstr + tblName & ".* "
13) tmpSQLstr = tmpSQLstr + " FROM "
14) tmpSQLstr = tmpSQLstr + tblName
15) tmpSQLstr = tmpSQLstr + " WHERE "
16) tmpSQLstr = tmpSQLstr + tblName
17) tmpSQLstr = tmpSQLstr + ".ForeignKey = 2 "
18) tmpSQLstr = tmpSQLstr + "ORDER BY "
19) tmpSQLstr = tmpSQLstr + tblName
20) tmpSQLstr = tmpSQLstr + ".Name;"
21)
22) strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
23) "Data Source=" & CurrentProject.Path & "\" & dbName & ";"
24)
25) Set conn = New ADODB.Connection
26) conn.Open strConn
27)
28) Set rs = New ADODB.recordSet
29) rs.Open tmpSQLstr, conn, adOpenKeyset, adLockOptimistic
30)
31) If rs.BOF And rs.EOF Then
32) Exit Sub ‘ No Records were found
33) End If
34)
35) NumOfRows = 1
36)
37) Do Until rs.EOF
38) myCollection.Add (rs.Fields.Item(0).value), CStr(numOfRows)
39) NumOfRows = numOfRows + 1
40) rs.MoveNext
41) Loop
42)
43) rs.Close
44) conn.Close
45)
46) Set rs = Nothing
47) Set conn = Nothing
48) End Sub

Thanks
--
Eddie Eytchison
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
When I open Outlook 2003 error message say can't open folders Ben Costigan Microsoft Outlook Installation 3 6th Aug 2008 09:41 PM
Error message, office outlook unable open set of folders, open wi =?Utf-8?B?R2VvcmdlIERvbGFu?= Microsoft Outlook Discussion 0 4th Jan 2006 09:18 PM
Error: Unable to open the Outlook window. The set of folders could not be open robert.fitzgibbons@usa.net Microsoft Outlook 0 17th Jun 2004 06:53 PM
Outlook2003 - open running, but error pops every 10 sec - Can't open Outlook.. TLVenus Microsoft Outlook 0 24th Nov 2003 07:37 PM
Problem: Unable to Open files/applications (error) must open using Run As.... Ray Windows XP Performance 0 5th Nov 2003 06:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:59 AM.