-
I Still cannot get this to work can anyone please tell me where the problem is and what i am doing wrong . a file number is entered
in a text box automaticaly the file exits but i am gettig a error 75 Please help am new to VB
Private Sub Open_File()
Dim intFreeFile As Integer
Dim strFileName as String
strFileName = txtFileName.Text
strFileName = Dir("d:\Home.txt")
intFreeFile = FreeFile
Open strFileName For Input As #intFreeFile
Do
Line Input #intFreeFile, strMember
Line Input #intFreeFile, strname
Line Input #intFreeFile, strlastname
Line Input #intFreeFile, straddress
Line Input #intFreeFile, strphone
Loop Until EOF(intFreeFile)
Close #intFreeFile
End Sub
i Know that i could set up a control array and it would be easier but i want to get this way to work first The runtime error is 75
i Know it is something really stupid that i have overlooked or forgot to do
-
Private Sub Open_File()
Dim intFreeFile As Integer
Dim strFileName As String
'''''''strFileName = txtFileName.Text
strFileName = Dir("d:\Home.txt")
intFreeFile = FreeFile
Open strFileName For Input As #intFreeFile
Do
'''''''Line Input #intFreeFile, strMember
'''''''Line Input #intFreeFile, strname
'''''''Line Input #intFreeFile, strlastname
'''''''Line Input #intFreeFile, straddress
'''''''Line Input #intFreeFile, strphone
Input #intFreeFile, strMember, strname, strlastname, straddress, strphone
Loop Until EOF(intFreeFile)
Close #intFreeFile
If you use line input#, it is to read entire records into a single variable. it also read an entire commas, quotation marks, exclamation marks, hyphens, everything else!
If you use #input, it is to read data into a list of variables...
ROSE
-
thxs rose But why am i getting a filepath error when i run the program eg 75
-
75?
I have no idea...
Perhaps, it could not find the directory path.
Let me see your code...? I can help you in any ways.
-
Hi Jessie,
The file isn't there
D:\Home.Txt
Try to create Home.Txt (empty also never mind), there should not be any error 75 again.
Does it help ?
Regards