Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old November 3rd, 2006, 01:10 PM
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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")
    Do While Not rstParts.EOF
    rstLOB![id_Part] = CStr(rstParts![id_Part])


Exit Sub

    MsgBox "Error No: " & Err.Number & "; Description: " & _
    Resume ErrorHandlerExit
End Sub

  #2 (permalink)  
Old November 3rd, 2006, 04:16 PM
Friend of Wrox
Points: 9,611, Level: 42
Points: 9,611, Level: 42 Points: 9,611, Level: 42 Points: 9,611, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts

Why are you using CStr() to move what looks like an Integer?

Change this: rstLOB![id_Part] = CStr(rstParts![id_Part])
To This: rstLOB![id_Part] = rstParts![id_Part]

And see what happens.


Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA code for entering the same data for dates rohit_ghosh Access VBA 1 May 3rd, 2007 09:45 AM
VBA Code to read the structure & data of an excel alam1 Excel VBA 0 April 24th, 2007 11:39 PM
Need help: Move data with store proc Gunny SQL Server 2000 3 July 28th, 2006 12:10 AM
Using VBA in excel to move information am6019a VB How-To 2 June 14th, 2006 08:15 AM
Move a file via code fordrs3 VB How-To 2 June 26th, 2003 01:04 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.