Results 1 to 11 of 11
  1. #1
    wee is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2009
    Posts
    5

    Help with exporting data

    Hello,



    I am trying to export some data out of my Access Query, but it seems to be truncating the data in my table at 255 characters. I have some data in a memo field and need to export the whole field as one.

    Is there a simple solution to this?
    Thanks!
    -wee

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922

  3. #3
    wee is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2009
    Posts
    5
    The fields only truncates on export. I am trying to export to a csv file. I don't have too much access experience, so I really would prefer not to split the fields up. Are there any other alternatives?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Are you using a query to create the recordset to export? If so, then post the SQL for the query here please.

  5. #5
    wee is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2009
    Posts
    5
    I used the Query Wizard and selected Simple Query Wizard.

    Is there a way to make a form, write a vb script, and export it? I need to export to a csv file if possible.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Start by going into the query in design mode and switch to SQL view and copy and paste what you see into a post here.

  7. #7
    wee is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2009
    Posts
    5
    This?

    Code:
    SELECT Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Table1.Name],"Â",""),"Ã",""),"¬",""),"¢",""),"„",""),"â",""),"'","\'"),'"',"") AS product, Manufactures.Mid, Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Description],"Â",""),"Ã",""),"¬",""),"¢",""),"„",""),"â",""),"'","\'"),'"',"") AS [desc], Categories.cid
    FROM (Manufactures INNER JOIN Table1 ON Manufactures.[Name] = Table1.[Manufacture]) INNER JOIN Categories ON Table1.[Category] = Categories.[name]
    WHERE ((Not (Manufactures.Mid)=0) AND (Not (Categories.cid)=0));

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    That is certainly no simple query. Have you considered puting the Replace functions in a different query?

  9. #9
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    Blimey, for a start get rid of all those replaces. Create a public function, such as
    Code:
     
    Public Function StripBadCharacters(AnyString) As String
     
    Dim strString As String
     
    strString = Replace(AnyString, "Â","")
    strString = Replace(strString, "¬","")
    strString = Replace(strString, "¢","")
    strString = Replace(strString, "„","")
    strString = Replace(strString, "â","")
    strString = Replace(strString, "'","")
    strString = Replace(strString, "\","")
    strString = Replace(strString, ""","")
     
    StrBadCharacters = strString
     
    End Function
    Then in your query

    it becomes


    Product:StrBadCharacters (Table1.[Name])

    Also naming a field Name is very bad this is an Access Reserved word you can get into alsorts of problems, you nust ensure that you enclose it with [] to tell Access this is a field.

    Rebuild your query and retry, see what happens then.

    David

  10. #10
    wee is offline Novice
    Windows 7 Access 2007
    Join Date
    Sep 2009
    Posts
    5
    Great! That works awesome

    Sorry for slow reply, have been busy with school

    One last question, is there a way to export to a tabbed csv file in access via VBA, so I can click a button on my form to export automatically?

  11. #11
    dcrake's Avatar
    dcrake is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Aug 2009
    Posts
    435
    Yes you can, suggest you first do this via a macro using the TransferSpreadsheet command. Then convert your macro to VB and paste the code behind you on click event of the button.

    David

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

Similar Threads

  1. Exporting Quieres - Filenames
    By jquickuk in forum Programming
    Replies: 1
    Last Post: 05-02-2009, 06:51 PM
  2. Exporting data to text file
    By NC_juggler in forum Import/Export Data
    Replies: 0
    Last Post: 11-21-2008, 10:51 AM
  3. Exporting a Switchboard
    By Hawkx1 in forum Forms
    Replies: 1
    Last Post: 07-08-2008, 06:59 AM
  4. Exporting a Report to Excel
    By bullwinkle55423 in forum Reports
    Replies: 0
    Last Post: 12-11-2007, 10:27 AM
  5. Exporting a chart to Excel?
    By hraup in forum Access
    Replies: 0
    Last Post: 08-31-2006, 12:21 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