Results 1 to 4 of 4

Thread: opening a file for output

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    UK
    Posts
    300
    I am looking after a new application written with VBA for access which has these lines in it.

    gen declarations
    Private Const IMASPRODUCTIONASCIIFILE As String = "ImasProd.dat"
    Private Const FTPDIR As String = "c:\ftp60\"

    sub to write to file
    Open FTPDIR & IMASPRODUCTIONASCIIFILE For Output As #1

    the open line is where it bombs out. The ftp60 dir is there on the PC but the dir does not contain the ImasProd.dat file prior to the running of the program. I thought that the prog would automatically create the file if it does not exist already. Is this not the case ?

    Any comments or help would be great.

    Many thanx
    locutus

    Resistance is futile

  2. #2
    Fanatic Member
    Join Date
    Oct 2000
    Location
    London
    Posts
    1,008

    Question ?

    Works for me - sure you are not using #1 anywhere else?

    Strange one,

    Paul.
    Not nearly so tired now...

    Haven't been around much so be gentle...

  3. #3
    Lively Member
    Join Date
    Oct 2000
    Location
    Houston, Texas - U.S.A.
    Posts
    84

    Wink

    You might try assigning a variable name to the keyword FreeFile, e.g.

    intModelFile = FreeFile
    Open strModel For Output As #intModelFile
    Do stuff here.......
    Close #intModelFile

    FreeFile automatically finds the next available file for input, output, append, etc. Be sure that you close the file when you're through with it.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 1999
    Location
    UK
    Posts
    300

    thanks , prob solved

    cheers guys problem solved , much appreciated
    Resistance is futile

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