thomasfmendiola
New member
- Local time
- Today, 05:29
- Joined
- Apr 26, 2011
- Messages
- 4
Hi All,
I have been trying to create a form that allows a user to view all records in a .dat file . I then want to populate the list box on the form with the phone number and names contained in the .dat file, I am also trying to incorporate error handling when opening the .dat file. I have been working on this for a few hours and keep getting an error. And at this point I am at a loss as to what I am doing wrong. Feel free to explain to me what I am doing wrong because I would rather know the code then just have a solution provided to me. Thanks in advance. Also I have attached a .jpg of the error box. Here is what I have:
Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim lsContactPhoneNumber As String
Dim lsContactFirstName As String
Dim lsContactLastName As String
Open "C:\Users\Thomas F. Mendiola\Documents\friends.dat" For Input As #1
Do While EOF(1)
Input #1, lsContactPhoneNumber, lsContactFirstName, lsContactLastName
lstFriends.AddItem lsContactPhoneNumber, lsContactFirstName, lsContactLastName
Loop
Close
End Sub
I have been trying to create a form that allows a user to view all records in a .dat file . I then want to populate the list box on the form with the phone number and names contained in the .dat file, I am also trying to incorporate error handling when opening the .dat file. I have been working on this for a few hours and keep getting an error. And at this point I am at a loss as to what I am doing wrong. Feel free to explain to me what I am doing wrong because I would rather know the code then just have a solution provided to me. Thanks in advance. Also I have attached a .jpg of the error box. Here is what I have:
Private Sub Form_Load()
On Error GoTo ErrorHandler
Dim lsContactPhoneNumber As String
Dim lsContactFirstName As String
Dim lsContactLastName As String
Open "C:\Users\Thomas F. Mendiola\Documents\friends.dat" For Input As #1
Do While EOF(1)
Input #1, lsContactPhoneNumber, lsContactFirstName, lsContactLastName
lstFriends.AddItem lsContactPhoneNumber, lsContactFirstName, lsContactLastName
Loop
Close
End Sub