C
Craig
Hello. I'm using an Access XP .apd (Access data project).
I've written a module in DAO that loops through each record in a table, does
some analyzing, then updates another table with a result.
However, I need to perform this same procedure on an .adp with similar data.
But I get the "object variable or with variable not set" error message
(because, from what I read, you can't have the "CurrentDB" term in the module.
Here's a snippet of my code:
Dim db As DAO.Database, rs As DAO.Recordset, rs1 As DAO.Recordset
Dim strX As String, x As Integer, i As Integer
ReDim MyArray(10) As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("vwBase")
Set rs1 = db.OpenRecordset("tblResults")
'
Do While Not rs.EOF
..
..
..
..
Do While MyArray(i) <> ""
If InStr(strX, "@kyoc") = 0 Then
rs1.AddNew
rs1!Id = rs("ID")
rs1!Field1 = rs("Field1")
rs1.Update
Exit Do
End If
Loop
..
..
..
..
So, how do I identify and update a table def using ADO?? (similar to what I
did above with DAO?). I know the basics (ie, Dim conn as ADODB.Connection,
etc.). But what I need is to be able to replicate the above DAO procedure
using ADO.
Thanks.
I've written a module in DAO that loops through each record in a table, does
some analyzing, then updates another table with a result.
However, I need to perform this same procedure on an .adp with similar data.
But I get the "object variable or with variable not set" error message
(because, from what I read, you can't have the "CurrentDB" term in the module.
Here's a snippet of my code:
Dim db As DAO.Database, rs As DAO.Recordset, rs1 As DAO.Recordset
Dim strX As String, x As Integer, i As Integer
ReDim MyArray(10) As String
Set db = CurrentDb()
Set rs = db.OpenRecordset("vwBase")
Set rs1 = db.OpenRecordset("tblResults")
'
Do While Not rs.EOF
..
..
..
..
Do While MyArray(i) <> ""
If InStr(strX, "@kyoc") = 0 Then
rs1.AddNew
rs1!Id = rs("ID")
rs1!Field1 = rs("Field1")
rs1.Update
Exit Do
End If
Loop
..
..
..
..
So, how do I identify and update a table def using ADO?? (similar to what I
did above with DAO?). I know the basics (ie, Dim conn as ADODB.Connection,
etc.). But what I need is to be able to replicate the above DAO procedure
using ADO.
Thanks.