Results 1 to 5 of 5

Thread: Change default delimiter in Access [Resolved via impossibility]

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Resolved Change default delimiter in Access [Resolved via impossibility]

    Is it possible to change the default delimiter from a comma to a pipe in Access? I want to create tables on the fly based on text files with different numbers and names of fields, but they're delimited by the pipe symbol. I don't want to create these by hand and then create import specifications for each one. Thanks.
    Last edited by salvelinus; Jan 3rd, 2005 at 05:13 PM.
    Tengo mas preguntas que contestas

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

    Re: Change default delimiter in Access

    One way to do it would be to create a macro that would do a 'Transfer Text'
    action with 'Import Delimited' as the transfer type. Also, create and save
    a 'Specification' for importing the file (this is the same steps you go through
    when setting up a file import. You get to specify the delimiter, etc.). Then
    when you run the macro it can import your files using your pre-choosen
    delimiter.

    HTH
    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
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Change default delimiter in Access

    How would I create a specification that isn't linked to a pre-existing table? I tried creating a macro, but it wanted the specification name, the table name to import to (there isn't one yet - it gets created, and it's different for each text file), and it wanted the name of the text file to import from (this is user chosen each time). Maybe I don't understand macros that well, rarely if ever use them. This would work - if commas were the delimiter in the text file:
    VB Code:
    1. 'this will create a table named tblAnyNameIGiveIt from whatever comma delimited
    2. 'text file the user chooses
    3. DoCmd.TransferText acImportDelim, , "tblAnyNameIGiveIt", "c:\UserSelected.txt", True
    but I can't get the delimiter argument after acImportDelim to accept the pipe symbol.
    Tengo mas preguntas que contestas

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

    Re: Change default delimiter in Access

    Yes, since you dont have the table ahead of time you can not create a specification
    either. Looks like you may just need to create a loop reading in the file and
    adding records to the table all in code.
    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
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: Change default delimiter in Access

    Well, thanks anyway. I don't know why MS doesn't give this option. It should be trivial to allow any character as a delimiter in TransferText.
    At least Split() is available.
    Tengo mas preguntas que contestas

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