Results 1 to 3 of 3

Thread: WHY WHY WHY

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    frustration setting in, atleast now I have no more file error path messages. The file that i am opening is a text file i donot want to create a control array to load textboxes maybelater . the file is formatted this way
    eg filenumber
    name
    last name
    address and so on

    when i open the file none of the data gets loaded into the variables it opens the file then skips the line input?? here is my code and any help would be appreciated

    Private Sub Command1_Click()
    Dim intfreefile As Integer
    strFileName = Dir("d:\home.txt")
    strFileName = txtMember

    intfreefile = FreeFile

    Open strFileName For Input As intfreefile
    Do While Not EOF(intfreefile)

    Input #intfreefile, strMember, strName, strLastname, strAddress, strPhone

    Loop
    Close #intfreefile
    Pass_Values
    End Sub

    ------------------
    IF YOUR GONNA BE A BEAR
    BE A GRIZZLY

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229

    Post


    Hi Jessie,

    You may try this to solve your problem

    Private Sub ToRead()
    Dim intfreefile As Integer
    Dim strFileName As String
    Dim strMember As String
    Dim strName As String
    Dim strLastname As String
    Dim strAddress As String
    Dim strPhone As String

    strFileName = Dir("d:\home.txt")
    intfreefile = FreeFile

    Open strFileName For Input As #intfreefile

    Do While Not EOF(intfreefile)
    Input #intfreefile, strMember, strName, strLastname, strAddress, strPhone
    MsgBox (strMember & strName & strLastname & strAddress & strPhone)
    Loop

    Close #intfreefile

    End Sub

    Private Sub ToWrite()

    Dim intfreefile As Integer
    Dim strFileName As String
    Dim strMember As String
    Dim strName As String
    Dim strLastname As String
    Dim strAddress As String
    Dim strPhone As String

    strFileName = Dir("d:\home.txt")
    intfreefile = FreeFile

    strMember = "001 "
    strName = "Jessie "
    strLastname = "Do not know "
    strAddress = "Anywhere "
    strPhone = "Anynumber"

    Open strFileName For Output As #intfreefile
    Write #intfreefile, strMember, strName, strLastname, strAddress, strPhone
    Close #intfreefile

    End Sub

    Does it help ?


    Regards

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    ok keiko still didn't work so i am not using the "dir" function properly and i am not understanding the function correctly
    the files are stored in D drive in a folder
    called home so i'm nto sure if i need a attributes in the dir statement also
    eg Dir=("d:\home????")in the mean time i will keep trying to figure this out.I am using
    a textbox to set the file name
    eg txtmember the number entered would be the strfilename

    thxs jessie

    [This message has been edited by Jessie (edited 12-03-1999).]

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