• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 310
  • Last Modified:

How do I check for a valid local address to save a file?

I have a form that has a field with a http address and a field with a folder location. The command button when clicked downloads the file to the local folder. If the folder location is null it ask to browse to a location to save it. If the folder location has an address it saves it there. The problem is what if the folder location is in valid? i have attached file.  FileCopySave.mdb
0
seanlhall
Asked:
seanlhall
  • 5
  • 4
1 Solution
 
Rey Obrero (Capricorn1)Commented:
what is your basis for valid folder location?
0
 
seanlhallAuthor Commented:
For exaample if in the folder location it has a location that is not on that computer it will say it is save there even though it does not exsist. I would like the browse for folder to come up if the location is not correct.
0
 
Rey Obrero (Capricorn1)Commented:


if dir(me.txtFolderLocation,vbdirectory)="" then
   msgbox "Folder does not exists"
   exit sub
   else

    'save file here
end if
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
GRayLCommented:
How can your BrowseFolder function find a location that is not valid?  
0
 
seanlhallAuthor Commented:
runtime error 52 bad file or number. This happens when folderlocation is null, has valid address or not.
0
 
Rey Obrero (Capricorn1)Commented:
seanlhall,
did you try the codes  i posted above?
0
 
seanlhallAuthor Commented:
The folder location is where it is saved. If the location entered in the folder location is not valid for some reason, it will said it has saved the file there but it is not because the location is not valid.
0
 
seanlhallAuthor Commented:
yes that is the error i get.
0
 
Rey Obrero (Capricorn1)Commented:
try this

if dir(me.txtFolderLocation & "",vbdirectory)="" then
   msgbox "Folder does not exists"
   exit sub
   else

    'save file here
end if
0
 
seanlhallAuthor Commented:
That was what I was looking for, thanks.
0

Featured Post

Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now