Solved

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

Posted on 2011-02-21
10
292 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
  • 5
  • 4
10 Comments
 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Expert Comment

by:Rey Obrero
ID: 34943648


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

    'save file here
end if
0
 
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 119

Expert Comment

by:Rey Obrero
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 119

Accepted Solution

by:
Rey Obrero 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

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Today's users almost expect this to happen in all search boxes. After all, if their favourite search engine juggles with tens of thousand keywords while they type, and suggests matching phrases on the fly, why shouldn't they expect the same from you…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now