Results 1 to 16 of 16

Thread: [RESOLVED] export data from msaccess to txt file....

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Resolved [RESOLVED] export data from msaccess to txt file....

    hello,


    I hope thet someone can help me

    I have databese in access 2000 named db2.mdb and a table withe the name Nomi

    Nomi in italian it's Names

    I whant to export records "Nomi" to txt file ' c:\myfile.txt ' the output file shuld be like this


    carlo,marco,pippo, .......etc
    max,roberto......etc


    can anyone help me
    thanks

  2. #2
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    You can use the .TransferText function in Access.
    VB Code:
    1. Application.DoCmd.TransferText acExportDelim, , "Table1", "C:\Test.txt", True
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    thanks RobDog888 for u'r quick answer

    sorry bet I forgot to say somyhing before

    I use visual basic 6

  4. #4
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    Ok, well I seen you were saying export from access as if you were doing it with VBA. No worries.

    You can use ADO to connect to the db and read the table into a recordset and then do a save.


    VB Code:
    1. '...
    2. oRs.Save "C:\Test.txt", adPersistADTG
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    thanks RobDog888 for u'r time, but I'm new in visual basic and what u wrote for, as we saying in italy, is ARABIC ! thanks any way it was kind from u to answer me, I think taht I have to study a lot...

    P.S. sorry for my bad english
    have a nice time ciao

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    These two threads are a great place to start for learning ADO.

    http://vbforums.com/showthread.php?t=349994
    http://vbforums.com/showthread.php?t=416225
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    I've allreadt saw it, I have sart learning frome there u know.
    I can connect ado to db and read/change/insert data to db, visual db in datagread....

    but now I'm blocked here at the end of my prog. I need to export a record of table into txt or msword file, I'm in this step about 4 days I've searched everyware. maybe i need to go sleep and tomorow how knows....

    thanks

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    But if you can do that then you should have a recordset object and just need to save its data if its populated with the needed table.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    ok, I can get the data from the table Nomi, lets say that I got the name "marco and francesco" now from visual basic how can I make a txt file "C:\myfile.txt" and insert the names in to it??
    I need to make a txt file and insert any "data" in this format
    es
    marco,francesco, anna,......etc

    I hope that I'm clear

  10. #10
    New Member
    Join Date
    Nov 2006
    Posts
    13

    Re: export data from msaccess to txt file....

    Quote Originally Posted by RobDog888
    You can use the .TransferText function in Access.
    VB Code:
    1. Application.DoCmd.TransferText acExportDelim, , "Table1", "C:\Test.txt", True
    What if this was the other way around??

    From a text file to a Database? I know the database must me design with at least 1 table...

  11. #11
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    es, you can just use the acImportDelim parameter to specify an import.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  12. #12

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    thnkes elgalloloco

    lets forget the database ok
    All I need is: form my app "in visual basic" to creat a txt file "c:\myfile.txt"and insert 2 value withe comma the output of myfile in this format


    value1,value2

    and nothing else

    can I do that?

  13. #13
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    Sure, just use basic File I/O

    VB Code:
    1. Open "C:\Test.csv" For Output As #1
    2.     Print #1, "Meow, meow, meow!"
    3. Close #1
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  14. #14

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    ohhh yes thats ok for me just one more question can I do it without the (" ")

    if it is possible like this Meow, meow, meow

    thanks RobDog888

  15. #15
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: export data from msaccess to txt file....

    Just change the file extension to a txt file. Thecsv places text qualifiers on there by default.
    VB Code:
    1. Open "C:\Test.txt" For Output As #1
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  16. #16

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    14

    Re: export data from msaccess to txt file....

    hi RobDog888,
    U solved my problem thanks now I can go on I wish u a good day



    thanks a lot
    asamy
    Last edited by asamy; Nov 3rd, 2006 at 11:21 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width