Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2002

    Unanswered: Batch Transfer of Spreadsheets in to Access

    I want to be able to Transfer a number of worksheets from excel in to Access. I have constructed a table with the Transfer Spreadsheet info. For each spreadsheet. I have attached a portion of the code. The error I get is runtime error 13, type mismatch. What I want to happen is the code cycles through the records Importing each spreadsheet from the info in the table. But I get this error when it hits the DoCmd line.

    Dim dbM As Database, tblI As Recordset, fldA As Field, fldB As Field, fldC As Field, fldD As Field, fldE As Field, fldF As Field
    Set dbM = CurrentDb()
    Set tblI = dbM.OpenRecordset("tblImportXls", dbOpenTable)
    Set fldA = tblI("TransferType")
    Set fldB = tblI("SpreadType")
    Set fldC = tblI("FileName")
    Set fldD = tblI("TableName")
    Set fldE = tblI("FieldName")
    Set fldF = tblI("Sheet")

    DoCmd.Hourglass True

    Do Until tblI.EOF
    DoCmd.TransferSpreadsheet fldA, fldB, fldD, fldC, fldE, fldF

    Hope someone can help with this as I am in a jam.

  2. #2
    Join Date
    Jul 2001
    Make sure that all the data types in the table 'tblImportXLS' are set to Text and you should solve the type mismatch error....


  3. #3
    Join Date
    Feb 2002

    Batch Transfers

    Have checked that the table fields are set to text, they are set already, this is why I am confused.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts