Solved

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

Posted on 2011-02-21
10
293 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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
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…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

895 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

15 Experts available now in Live!

Get 1:1 Help Now