E
EMP
I have given a sample of my code. It is not making
connection to the database. I get a recordcount of -1
which is weird. What am I doing wrong? Can anyone help
me out. Thanks!
Dim strSQL As String
Dim objADOConnect As New ADODB.Connection 'connection
Dim objRecSet As New ADODB.Recordset 'recordset
Dim objCommand As New ADODB.Command 'command
strSQL = "SELECT [index_id],[folder_name],[parent_id]
FROM Folder_Info" & _
" WHERE [parent_id] = '0'" & _
" ORDER BY [folder_name]"
With objADOConnect
.ConnectionString = "DBQ=speakers.mdb;" & _
"DRIVER={Microsoft Access Driver
(*.mdb)};" & _
"DefaultDir=C:\My Documents\Eve
Marie\Projects\Speaker_Specialist\Data;"
'.ConnectionString = "Provider =
Microsoft.Jet.OLEDB.4.0; Data Source= " & _
"C:\My Documents\Eve
Marie\Projects\Speaker_Specialist\Data\speakers.mdb"
.Open
End With
With objCommand
.CommandText = strSQL
.CommandType = adCmdText
.ActiveConnection = objADOConnect
Set objRecSet = .Execute ****This is the problem area
End With
connection to the database. I get a recordcount of -1
which is weird. What am I doing wrong? Can anyone help
me out. Thanks!
Dim strSQL As String
Dim objADOConnect As New ADODB.Connection 'connection
Dim objRecSet As New ADODB.Recordset 'recordset
Dim objCommand As New ADODB.Command 'command
strSQL = "SELECT [index_id],[folder_name],[parent_id]
FROM Folder_Info" & _
" WHERE [parent_id] = '0'" & _
" ORDER BY [folder_name]"
With objADOConnect
.ConnectionString = "DBQ=speakers.mdb;" & _
"DRIVER={Microsoft Access Driver
(*.mdb)};" & _
"DefaultDir=C:\My Documents\Eve
Marie\Projects\Speaker_Specialist\Data;"
'.ConnectionString = "Provider =
Microsoft.Jet.OLEDB.4.0; Data Source= " & _
"C:\My Documents\Eve
Marie\Projects\Speaker_Specialist\Data\speakers.mdb"
.Open
End With
With objCommand
.CommandText = strSQL
.CommandType = adCmdText
.ActiveConnection = objADOConnect
Set objRecSet = .Execute ****This is the problem area
End With