Results 1 to 4 of 4

Thread: Export Issue

  1. #1
    Join Date
    Jan 2007
    Posts
    1

    Unanswered: Export Issue

    Hello dBforums users,

    I did a little searching and couldn't find much related to my problem. I am trying to export my table to a text file using a module and VBA code. I created a specification through the export wizard called "Special Output" and I have it saved as

    Field Delimiter = {space}
    Text Qualifier = {none}

    that basically gives me no delimiters at all for my output. My code follows as

    Code:
     DoCmd.TransferText acExportDelim, "Special Output", "TimeCard", "C:\temp\timecard.txt"
    I followed the example from Microsoft to the Tee. When you press F1 highlighted on TransferText, it says it will create a file if it doesn't exist or it will over-ride one that does exist. So I give it a filename because its required (which I also don't like because now i need to move that file every time, I would love it if the dialog box came up asking where to save and what to save it as) but anyways I then get a "Run-Time error ' 3011': The Microsoft Jet database engine could not find the object 'timecard#txt'. Make sure the objects exists..." blah blah. Why did it replace the . (Period) with the # (pound symbol).

    It should have created one anyways, like it said it would, so i then create a blank file called "timecard.txt" where it will export it too, I click my form button again and it gives me the same error, BS right, so i look to find my file that i just created, and not its GONE. Its been deleted automatically. I don't know what happened.

    I could go on forever and sorry its so long but the forums says to give a full explanation. Ask for me details and you shall receive. I just need a method to export my table to a text file with no delimiters (basically what I previous said)
    Thanks

  2. #2
    Join Date
    Apr 2006
    Posts
    157
    in case it might be of interest

    TxtFSO.CreateTextFile (filename)

    Set DWGfile = TxtFSO.GetFile(filename)

    Set DWGstrm = DWGfile.OpenAsTextStream(filename)
    Only quitters quit!

  3. #3
    Join Date
    Apr 2006
    Posts
    157
    in case it might be of interest

    i find using the filesystem object easier to play with
    Code:
        dim txtfso as filesystemobject
        dim txtfile as file
        dim txtstrm as textstream
    
    
        Set TxtFSO = new FileSystemObject
    
        TxtFSO.CreateTextFile (filename)
    
        Set txtfile = TxtFSO.GetFile(filename)
        
        Set txtstrm = txtfile.OpenAsTextStream(filename)
    
        txtstrm.WriteLine "anything i want to write"
    Only quitters quit!

  4. #4
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I just had a go at running that code through curiosity -
    It doesn't recognise "fileSystemObject" "User-defined type not defined"
    George
    Home | Blog

Posting Permissions

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