Results 1 to 5 of 5

Thread: importing nulls

  1. #1
    Join Date
    Oct 2003
    Location
    Brisbane, Australia
    Posts
    30

    Question Unanswered: importing nulls

    Hi,

    I am importing an excel spreadsheet into one of my tables using access 2000 via the TransferSpreadsheet command.

    The only problem I am facing is that there are times when one of the fields are going to be blank. When I try and import this data, it creates an error table named something like "Sheet1$_ImportErrors" identifying the blank fields.

    Is there any way of stopping this from generating the error table? I have tried making the column not required but it still does it. The data imports fine, it's just this importerror table is annoying and they will just keep on building up if they are not deleted.

    Any help would be muchly appreciated.

    Cheers.

  2. #2
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Use the currentdb.Tabledefs("Name").delete command to clean them. Tho if ALL your fields are correctly filled and "required" and such there should be one generated.

    Regards

  3. #3
    Join Date
    Oct 2003
    Location
    Brisbane, Australia
    Posts
    30
    Hi namliam,

    Thanks for the advice. I have never used that command before but it is giving me a member or data member not found error.

    This is what my line of code looks like:

    CurrentDb.TableDefs("Sheet1$_ImportErrors").Delete

    ...and the table is definitely there!

  4. #4
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    .delete dont excist, i have fallen for that one more often

    try: docmd.DeleteObject acTable,"TableName"

    Regards

  5. #5
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    You might even want to make a loop like so:

    Code:
        Dim tbl As DAO.TableDef
        For Each tbl In CurrentDb.TableDefs
            If tbl.Name Like "Sheet*Importerrors*" Then Debug.Print tbl.Name
        Next tbl
    To make sure you get them all (make sure the DAO reference is set, Tools=>References=> Microsoft DAO 3.?? Library)

    Regards

Posting Permissions

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