Solved

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

Posted on 2011-02-21
10
296 Views
Last Modified: 2012-05-11
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
Comment
Question by:seanlhall
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
10 Comments
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34943413
what is your basis for valid folder location?
0
 

Author Comment

by:seanlhall
ID: 34943614
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
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34943648


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

    'save file here
end if
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 44

Expert Comment

by:GRayL
ID: 34943801
How can your BrowseFolder function find a location that is not valid?  
0
 

Author Comment

by:seanlhall
ID: 34943862
runtime error 52 bad file or number. This happens when folderlocation is null, has valid address or not.
0
 
LVL 120

Expert Comment

by:Rey Obrero (Capricorn1)
ID: 34943879
seanlhall,
did you try the codes  i posted above?
0
 

Author Comment

by:seanlhall
ID: 34943880
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
 

Author Comment

by:seanlhall
ID: 34943890
yes that is the error i get.
0
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 34943910
try this

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

    'save file here
end if
0
 

Author Closing Comment

by:seanlhall
ID: 34944034
That was what I was looking for, thanks.
0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question