J
JDeBeer
Switching from DAO to ADO
I have a table of dates, times, and events. I want to creat a value
in a field based on some logic. Am now learning about ADO and cannot
place a text value in a text field.
Attached is the code. Code compiles fine. Where I get thrown out is
marked with "Not Working".
Error msg "Object or provider is not capable of performing requested
operation"
Thanks for any help.
jdb
=================
Sub OpenRecordSet()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
'rst.Open "TrendTest", CurrentProject.Connection
rst.Open "tblTrendTest", CurrentProject.Connection
' conn , adOpenDynamic, , adCmdTableDirect
If Not (rst.BOF And rst.EOF) Then
rst.MoveFirst
End If
'Loop through the recordset
Do Until rst.EOF
rst.Fields("PrckDateCycle").Value = "test " ‘NOT WORKING"
rst.Update
rst.MoveNext
Loop
'Close and Destroy recordset
rst.Close
Set rst = Nothing
Set conn = Nothing
Proc_Exit:
Exit Sub
Proc_Err:
MsgBox Err.Description, vbCritical
Resume Proc_Exit
End Sub
I have a table of dates, times, and events. I want to creat a value
in a field based on some logic. Am now learning about ADO and cannot
place a text value in a text field.
Attached is the code. Code compiles fine. Where I get thrown out is
marked with "Not Working".
Error msg "Object or provider is not capable of performing requested
operation"
Thanks for any help.
jdb
=================
Sub OpenRecordSet()
Dim conn As ADODB.Connection
Dim rst As ADODB.Recordset
Set conn = CurrentProject.Connection
Set rst = New ADODB.Recordset
'rst.Open "TrendTest", CurrentProject.Connection
rst.Open "tblTrendTest", CurrentProject.Connection
' conn , adOpenDynamic, , adCmdTableDirect
If Not (rst.BOF And rst.EOF) Then
rst.MoveFirst
End If
'Loop through the recordset
Do Until rst.EOF
rst.Fields("PrckDateCycle").Value = "test " ‘NOT WORKING"
rst.Update
rst.MoveNext
Loop
'Close and Destroy recordset
rst.Close
Set rst = Nothing
Set conn = Nothing
Proc_Exit:
Exit Sub
Proc_Err:
MsgBox Err.Description, vbCritical
Resume Proc_Exit
End Sub