Access 2003 mismatch type 13 error already loaded DAO library

T

TimkenSteve

HI all,
I am using a loop to populate the last field of a table and am getting
the mismatch erorr. When I made the code origionally It worked, now I
copyed all necessary tables and module to another database and it
errors?

Sub usbNormal()

Dim db As DAO.Database
Dim rstOld As DAO.Recordset
Dim rstNew As DAO.Recordset
Dim iFields As Integer

Set db = CurrentDb()
Set rstOld = db.OpenRecordset("CATS_Dump")
Set rstNew = db.OpenRecordset("CATS_DumpNormal", dbOpenDynaset)

With rstOld
.MoveFirst
Do Until .EOF
For iFields = 9 To rstOld.Fields.Count - 1
If .Fields(iFields) > 0 Then
rstNew.AddNew
rstNew.Fields("CATS") = ![CATS]
rstNew.Fields("Bill To Acct Code") = ![Bill To
Acct Code]
rstNew.Fields("Attachment Names") =
![Attachment Names]
rstNew.Fields("Agreement Status") = ![Agreement
Status]
rstNew.Fields("Agreement Type") = ![Agreement
Type]
rstNew.Fields("End Date") = ![End Date]
rstNew.Fields("Agreement Detail") = ![Agreement
Detail]
rstNew.Fields("Rebate Percentage") = ![Rebate
Percentage]
rstNew.Fields("PC") =
CInt(.Fields(iFields).Name)
rstNew.Update
End If
Next iFields
.MoveNext
Loop
End With
End Sub

any ideas?
Steve
 
J

John Nurick

Hi Steve,

Which line of code produces the error?

HI all,
I am using a loop to populate the last field of a table and am getting
the mismatch erorr. When I made the code origionally It worked, now I
copyed all necessary tables and module to another database and it
errors?

Sub usbNormal()

Dim db As DAO.Database
Dim rstOld As DAO.Recordset
Dim rstNew As DAO.Recordset
Dim iFields As Integer

Set db = CurrentDb()
Set rstOld = db.OpenRecordset("CATS_Dump")
Set rstNew = db.OpenRecordset("CATS_DumpNormal", dbOpenDynaset)

With rstOld
.MoveFirst
Do Until .EOF
For iFields = 9 To rstOld.Fields.Count - 1
If .Fields(iFields) > 0 Then
rstNew.AddNew
rstNew.Fields("CATS") = ![CATS]
rstNew.Fields("Bill To Acct Code") = ![Bill To
Acct Code]
rstNew.Fields("Attachment Names") =
![Attachment Names]
rstNew.Fields("Agreement Status") = ![Agreement
Status]
rstNew.Fields("Agreement Type") = ![Agreement
Type]
rstNew.Fields("End Date") = ![End Date]
rstNew.Fields("Agreement Detail") = ![Agreement
Detail]
rstNew.Fields("Rebate Percentage") = ![Rebate
Percentage]
rstNew.Fields("PC") =
CInt(.Fields(iFields).Name)
rstNew.Update
End If
Next iFields
.MoveNext
Loop
End With
End Sub

any ideas?
Steve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top