Results 1 to 8 of 8
  1. #1
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56

    Table Column Format/Input Mask

    I have problem loading data from an excel file in to a table. I usually import the excel file in to a table via VBA script (because there are some changes I need to do before importing).
    It was working fine until this week when the data in a cell for a particular column in the excel file changed from being 3 letters to 4 letters. The column in the table is defined as text.
    The data in this column usually looks like 001, 002, 003 etc but one of the cells in the excel file has data as P001. So now I get an error Runtime Error 3349 even though I have defined the column as text. When I change the data P001 to 004 similar to the other data, it works just fine. Is there a format or Input Mask I can set so that the data are correctly loaded in to the table?
    Or am I missing something?

  2. #2
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Open the table in design view and click on the field.
    Is the field data type TEXT?
    Check the field size - is it set to 3? If the field size is 3, change it to 5 or greater...

  3. #3
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56
    Yes, the field type is TEXT but No, the field size is set to 255....

  4. #4
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    So it must be something in the script... Are you using an Import specification in the script?

  5. #5
    mkc80 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2012
    Posts
    56
    Yes,
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblCustomer", "C:\Downloads\CurrentFile.xlsx", True, "Customer!"
    and this is where the execution stops and gives me a run time error 3349 "you cannot record your changes because a value you entered violates the settings defined for this table or list. Correct the error and try again"

  6. #6
    msoffice.vidyarthi is offline Novice
    Windows 7 64bit Access 2000
    Join Date
    Nov 2012
    Posts
    24
    could you attach both the excel and db files for analyzing purpose

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2000
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    The only thing I can see is the "!" in the last argument, "Customer!". That creates an invalid name.

    Code:
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "tblCustomer", "C:\Downloads\CurrentFile.xlsx", True, "Customer!"

  8. #8
    qa12dx is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    india
    Posts
    112
    haven't done this in a while, but why dont you save the excel file as a delimited text file. as long as the col headings and coll count are the same, i think it should work. also i would link the text file instead of importing it. use a append query in ur db to put into the table u want. this way all u would do in replace the text file and all else should run.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Input Mask
    By qbc in forum Access
    Replies: 2
    Last Post: 01-20-2012, 03:27 PM
  2. Custom Data input mask or format?
    By RiverAnimal in forum Database Design
    Replies: 2
    Last Post: 12-06-2010, 09:58 AM
  3. Input Mask characters stripped from table to table
    By svcghost in forum Import/Export Data
    Replies: 2
    Last Post: 12-01-2010, 10:01 AM
  4. day of week input mask
    By jacko311 in forum Programming
    Replies: 7
    Last Post: 11-15-2009, 12:56 PM
  5. Input mask
    By doobybug in forum Access
    Replies: 2
    Last Post: 06-17-2009, 09:40 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums