Using VBA Code to Move Data
I'm in Chapter 10 using the section "Using VBA Code to Move Data from a Non-Normalized Table to Linked Normalized Tables" (P. 341) in the Expert one-on-one MS Access Application Development.
I revised the code to use on my database, but when I run it I get Error 13: Type mismatch. I've check the parameters and matched them to the books. I created the code in a Module (not a class module)
I need help quickly if anyone can help. Here's the code.
Public Sub NewPartNoIDs()
On Error GoTo ErrorHandler
Dim rstLOB As DAO.Recordset
Dim rstParts As DAO.Recordset
Set dbs = SupplyChainDB_Rev3
Set rstLOB = dbs.OpenRecordset("qryLOBTestData")
Set rstParts = dbs.OpenRecordset("qryPartsTable")
rstLOB.MoveFirst
Do While Not rstParts.EOF
rstLOB.Edit
rstLOB![id_Part] = CStr(rstParts![id_Part])
rstLOB.Update
rstLOB.MoveNext
rstParts.MoveNext
Loop
ErrorHandlerExit:
Exit Sub
ErrorHandler:
MsgBox "Error No: " & Err.Number & "; Description: " & _
Err.Description
Resume ErrorHandlerExit
End Sub
|