Basic Code Cant Find Input File

J

James

I've got this code and for some reason it can't find the file listed as
input file... if I switch it to output it doesn't have a problem. Any
ideas?

Public Sub buildSQL()
Open "C:\UpdateUSAAID\1.txt" For Input As #1
Open "C:\UpdateUSAAID\excludeListSQL.txt" For Output As #2

Do While Not EOF(1)

Line Input #2, excludeMember

If Not IsNull(VN_CAP_REFERRAL_V1.EMAIL_ADDRESS.TXT) Then
Write #2, "This is my sql STATETEMENT WITH NUMBER: " +
excludeMember
End If



Loop
Close #1
Close #2
End Sub
 
T

Terry Kreft

Does the file exist?

Opening file for output will either, if the file exists, overwrite or
append to the file depending on the mode or create the file if it doesn't
exist so no, opening for output will not cause a problem.
 
J

James

The file does exist. I want it to be used to input IDs but for some
reason it can't find it.
 
J

James

I figured it out...
my files were named 1.txt.txt not just 1.txt... that was causing the
problem. Thanks though.
 
T

Terry Kreft

So it didn't exist then.


--

Terry Kreft


James said:
I figured it out...
my files were named 1.txt.txt not just 1.txt... that was causing the
problem. Thanks though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top