Results 1 to 2 of 2
  1. #1
    raynman1972 is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2012
    Posts
    31

    Problem with data type when importing CSV via VBA

    Hello,

    I am an Access rookie. I am trying to import a CSV file that has a number column that can vary (1,11, 111.001101, 11.000001) and when I try to import this via VBA, I can't seem to make it work without calling it a Text field. My challenge with the data is that I cannot control the formatting as I am getting the files from various parties and I need some way of programmatically rounding this out to the nearest whole number.

    I have encountered this before with Access and imports, but it was only with dates and times. I was able to work around these by putting in a module that makes a new column and copies the data over as the proper data type and this works- just not sure how to do this for varying integer/double/long data types.

    Any thoughts?

    Cheers,

    Ray

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    I was experimenting with this just yesterday. Only opposite issue, the import wouldn't accept text values in a field where the values were a mix of alphanumeric. Example: 132789, 132789S1. Insisted on reading the field as numeric and rejecting the S1 suffixed values. Finally saved the CSV as an Excel workbook then the import worked.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Type Conversion Failure When Importing txt File
    By Eka1618 in forum Import/Export Data
    Replies: 15
    Last Post: 10-29-2012, 06:45 PM
  2. Replies: 5
    Last Post: 01-09-2012, 05:55 PM
  3. Problem with Number Data Type
    By 1953hogan in forum Forms
    Replies: 3
    Last Post: 07-14-2011, 09:01 AM
  4. Access and SQL Server data type problem
    By rayc in forum Access
    Replies: 1
    Last Post: 09-10-2010, 07:27 PM
  5. Importing html data - Carriage Return Problem
    By MichelleNZ in forum Import/Export Data
    Replies: 1
    Last Post: 11-26-2009, 05:13 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