Error Importing Spreadsheet

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • dayharbor
    New Member
    • Jun 2007
    • 8

    Error Importing Spreadsheet

    I'm fairly new to VBA, but I have imported Excel files into a tbl using VBA before and it worked. This time I am getting an error that says

    Field 'F1' doesn't exist in destination table 'tblWhatever'

    Can anyone point me in the right direction? I have already spent a lot of time re-checking the calling parameters, Excel file and table design many times over.

    Thanks so much!
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Originally posted by dayharbor
    I'm fairly new to VBA, but I have imported Excel files into a tbl using VBA before and it worked. This time I am getting an error that says

    Field 'F1' doesn't exist in destination table 'tblWhatever'

    Can anyone point me in the right direction? I have already spent a lot of time re-checking the calling parameters, Excel file and table design many times over.

    Thanks so much!
    I'm not sure what causes it, but adding Field [F1] to 'tblWhatever' prior to the Import will solve the problem.

    Comment

    • dayharbor
      New Member
      • Jun 2007
      • 8

      #3
      Originally posted by ADezii
      I'm not sure what causes it, but adding Field [F1] to 'tblWhatever' prior to the Import will solve the problem.


      I did try that, but then the error says

      Field 'F2'...

      I added "F2" and it said

      Field 'F3' doesn't exist...

      Comment

      • dayharbor
        New Member
        • Jun 2007
        • 8

        #4
        Originally posted by ADezii
        I'm not sure what causes it, but adding Field [F1] to 'tblWhatever' prior to the Import will solve the problem.

        Can you offer any help on this?

        As I mentioned, I had already tried this, but it didn't work.

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          Originally posted by dayharbor
          Can you offer any help on this?

          As I mentioned, I had already tried this, but it didn't work.
          Make sure that the hasfieldnames Argument is specified correctly:
          [CODE=vb]DoCmd.TransferS preadsheet [transfertype][, spreadsheettype], tablename, filename[, hasfieldnames[, range][/CODE]

          Comment

          • dayharbor
            New Member
            • Jun 2007
            • 8

            #6
            Originally posted by ADezii
            Make sure that the hasfieldnames Argument is specified correctly:
            [CODE=vb]DoCmd.TransferS preadsheet [transfertype][, spreadsheettype], tablename, filename[, hasfieldnames[, range][/CODE]

            Yes, I needed to specify 'TRUE' for that argument! Problem solved.

            Thank you for your help.

            Comment

            Working...