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
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