Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Incompatible Type? Filesys.FileExists(txtPath) 1

Status
Not open for further replies.

cutestuff

Technical User
Sep 7, 2006
162
CA
hi,

Quick question (hopefully). I am trying to put a check on my code. I have a textbox (txtPath) where I put the value of the path of a file the user selects. Everytime I try to put a check on it though, it says, "Incompatible Type" or something like that. It works fine without the check, however, I would like the code to put out a msgbox if the user clicks on "upload" without selecting a file.
A part of my code is below:

Code:
If txtPath = Null Then
  MsgBox "Please select a file!", vbOkOnly, "File Missing!"
Else
 '....some code here...

 If filesys.FileExists(txtPath) Then
                filesys.CopyFile txtPath, destPath
                MsgBox "File Upload Successful.
End If
It keeps complaining around the line:
If filesys.FileExists(txtPath)...

Anyone know how to fix it?
Please?
Thank you so much in advance...
 
What application are you writing in? Is filesys an object variable? If so, what type?

[red][banghead]— Artificial intelligence is no match for natural stupidity.[/red]
 
Replace this:
If txtPath = Null Then
with either this:
If IsNull(txtPath) Then
or this:
If Trim(txtPath & "") = "" Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top