Results 1 to 11 of 11
  1. #1
    TylerTexas is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    7

    Access 2003 TransferSpreadsheet adds a quote mark to each text field

    Doing this in Access 2003


    DoCmd.TransferSpreadsheet acExport, , "BuyAKit", efn, True

    Exports data fine to Excel 2003
    but each text field is prepended with an '
    This ' is not in the table fields at all, so it must be part of the transfer method.

    Any simple workarounds?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    These fields are defined as text datatype? Do these fields contain only number characters, as in zip code or SSN?
    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.

  3. #3
    TylerTexas is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    7
    Yes, defined as text. And SOME of the fields do have only numbers in them, but ALL text fields, regardless of content begin with '

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Are you exporting a query or table? If query, does this happen with the same fields if export table?

    Want to provide db for analysis? Follow instructions at bottom of my post.
    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.

  5. #5
    TylerTexas is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    7
    I build the table in VBA from a recordsource that is filled by an SQL query.
    The table is built with this code in a do loop:

    rsb.AddNew
    rsb!Item = rsa!Item
    rsb!Description = rsa!Description
    rsb!Need = rsa!Qty * AssyQty 'Multiply qty by assemblies required
    rsb!Vendor = rsa!Vendor
    rsb!Cost = rsa!Cost
    rsb.Update
    BuyAKitAddAssy = BuyAKitAddAssy + 1
    rsa.MoveNext

    I can look at the table after it's built and there is no '
    But when I export to excel, the fields ITEM, DESCRIPTION, VENDOR all start with '
    They are the text fields.
    The NEED and COST fields are numeric and don't start with '

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I have seem some odd things when working directly between Excel and Access (sometimes they talk to each other and assume too much!).

    Out of curiosity, does it happens if you export to Excel using the OutputTo action instead of the TransferSpreadsheet action, i.e.
    Code:
        DoCmd.OutputTo acTable, "BuyAKit", "MicrosoftExcelBiff8(*.xls)", efn, False, "", 0
    Also, out of curiosity, what is the value of "efn"? I wonder if you might get odd results if you choose a file name that have an extension that is not a valid Excel extension.

  7. #7
    TylerTexas is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    7
    OutputTo method DOES WORK.

    efn = "QBX_BuyAKit.xls"

    And I was starting Excel with:
    Call Shell("excel.exe " & efn, vbNormalFocus)

    Which I now don't have to do by setting Autostart TRUE in the OutputTo method.

    Still curious. Noone else ever seen this?
    I would think it could be duplicated by simply using my export command in 2003
    Like I said, viewing the table seems fine.
    Maybe has to do with how I populate the records manually

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,967
    Yes, I have seen this. As JoeM says, communication between apps not perfect.
    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.

  9. #9
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Yes, I have seen this. As JoeM says, communication between apps not perfect.
    I am convinced that Microsoft sometimes goes overboard and "outthinks itself".

    In any event, I'm glad to see it looks like you got a workable solution!

  10. #10
    TylerTexas is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    7
    Thanks so much for your help Joe.
    I love simple solutions.
    This one has my curiosity piqued but I will resist spending a day figuring out which conditions are the culprit.
    It does frustrate me that a random newbie like myself seems to find all this weirdness
    Thanks again.

  11. #11
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Your welcome.

    The reason I was quick to recommend using OutputTo in lieu of TransferSpreadsheet is because I have experienced issues transferring data between Excel and Access also, and if one doesn't work well, I learned to try the other. I gave up trying to figure out why long ago. It might not even be something on the Access side, it could be something on the Excel side of the communication. Without knowing how Micrsoft handles that communication between the two behind the sides, it can sometimes be next to impossible to figure out why it is doing that.

    The one that used to frustrate me to no end is importing Excel files into existing Access tables. Often times, they will error out and not import anything, but it gives you absolutely no indication of which fields or records may be the culprit, just a generic "Import Failed" message. Its about as useful as getting the old "General Default" error from the years ago...

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

Similar Threads

  1. Replies: 2
    Last Post: 05-22-2012, 03:29 PM
  2. Replies: 3
    Last Post: 04-20-2012, 04:33 PM
  3. Using double quote as text delimiter
    By EddieN1 in forum SQL Server
    Replies: 4
    Last Post: 03-11-2012, 08:49 PM
  4. TransferSpreadsheet - Use first row as field names
    By jgelpi16 in forum Programming
    Replies: 1
    Last Post: 02-23-2011, 11:41 AM
  5. Replies: 5
    Last Post: 02-20-2011, 08:22 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