Results 1 to 12 of 12

Thread: Error 53

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715

    Angry

    I got 2 forms:
    form1
    and
    form2

    in form1 I tell it to make a file called C:\b.dat

    in form2 I tell it read from the file c:\b.dat at form load

    As soon as I run the program it says

    error 51, file not found

    it says that because the file doesn't exist yet

    so what do I do

    if you dont know what I mean, I could try to explain it another way
    NXSupport - Your one-stop source for computer help

  2. #2
    Guest
    Did you create the file before you read form it?

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    The first form that starts is form 1

    then the suer fills in the information, and clicks OK

    then it writes the file c:\b.dat

    and loads form2

    at form load of form to, it reads the file c:\b.dat and puts the information of that file into labels

    but as soon as I clikc RUN>START

    the error message comes up, when I click debug, it goes to the code of form2

    and the yello thing is pointed to where it says to read c:\b.dat

    please help
    NXSupport - Your one-stop source for computer help

  4. #4
    Guest
    What are you using to read and write the bat file?
    And you could use the Dir function to check if the file exists and if it doesn't than write it.

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    you don't get it:

    a form writes a file

    another forms reads it



    the problem is that vb detets that the file that form1 was supposed to qrite to doesn't exsist yet (because form1 didnt write to it)
    NXSupport - Your one-stop source for computer help

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    if you want I can email you the forms
    NXSupport - Your one-stop source for computer help

  7. #7
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    ok, so first of all:
    if u are using the Open statement then:
    when you open a file or output it creates the file, otherwise (input) doesn't
    if you are using another way to open the file, please tell me so that i can tell u what to do, ok?
    byt,
    yair

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    i guess I can't explain myself, so

    want me to email it to you?

    just leave your email, and I will send it ASAP

    (same to megatron, and matt)
    NXSupport - Your one-stop source for computer help

  9. #9
    Lively Member
    Join Date
    Jul 2000
    Posts
    82
    ok,
    then can u send me the forms on email??
    to [email protected]
    or
    [email protected]
    bye,
    yair

  10. #10

    Thread Starter
    Frenzied Member
    Join Date
    Jun 2000
    Location
    East Providence, RI
    Posts
    1,715
    sent
    NXSupport - Your one-stop source for computer help

  11. #11
    Hyperactive Member
    Join Date
    May 2000
    Location
    Or
    Posts
    316
    If I understand you right, this should solve your problem:

    In form1:

    Code:
    Private Sub Command1_Click()
    Open "c:\windows\desktop\temp.txt" For Append As #1
        Print #1, Text1.Text
    Close #1
    Form2.Show
    
    End Sub

    In form2

    Code:
    Private Sub Form_Load()
    Dim fso, sTemp(1)
    
    Set fso = CreateObject("scripting.FileSystemObject")
    Do While fso.FileExists("c:\windows\desktop\temp.txt") = False
        DoEvents
    Loop
    
    Set sTemp(0) = fso.GetFile("c:\windows\desktop\temp.txt")
    Set sTemp(1) = sTemp(0).OpenAsTextStream(1, -2)
    sVar = sTemp(1).ReadAll
    Label1.Caption = sVar
    
    
    End Sub
    Hope this helps

  12. #12
    Guest
    You do not need to e-mail your Form. It's only the Open statement that would be giving the Error.

    To Write to the file. (If it doesn't exsist, It will be created)
    Code:
    Open "C:\b.dat" For Output As #1
    Write #1, "One", "Two", "Three"
    Close #1
    To Read the file
    Code:
    Open "C:\b.dat" For Input As #1
    Input #1, A, B, C
    Close #1
    
    Label1 = A
    Label2 = B
    Label3 = C

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