PDA

Click to See Complete Forum and Search --> : WHY WHY WHY


Jessie
Dec 3rd, 1999, 05:48 AM
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

Keiko
Dec 3rd, 1999, 07:48 AM
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

Jessie
Dec 3rd, 1999, 09:30 AM
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).]