VB6 と ADODB を使用して Access 2000 DB を開きます。接続文字列が開きます。レコードセットを開く前に、接続の .STATE を取得してこれを確認します。
Private Sub Form_Load()
With conn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" _
& "Data Source=C:\Path to database\MyDb.mdb;"
End With
conn.Open
Debug.Print conn.ConnectionString
End Sub
以下のスニペットは、エラーが発生した行を示しています
Private Sub btnGO_Click()
Dim strDbName As String
Dim strg As String
Dim chkr As Variant
Dim MyCnt As Integer
chkr = False
Dim strsql As String
strsql = "Select * from [dbo].[BidItem]"
With rst
.ActiveConnection = conn
.Source = "Select * from [dbo].[BidItem]"
.Open -------------------------------------> Errors at this point
End With
With rst
If Not .EOF And Not .BOF Then
.MoveFirst
MyCnt = .RecordCount
End If
End With
MsgBox ("open")
MsgBox ("Count of TableRows: " & MyCnt)
Set rst = Nothing
End Sub
編集:正確なエラーメッセージはRun-Time Error '-2147467259 (80004005)': Could not find file 'C:\Program Files (x86)\Microsoft Visual\VB98\dbo.mdb'