Microsoft Access Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseMicrosoft Access Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old January 30th, 2004, 03:05 PM
esskaykay esskaykay is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 34 esskaykay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 25 sec
Reputation Power: 5
Determine if file is available

I’ve posted a similar question but…

What I’m looking for is a way to see if a file is available and if so, run a macro; otherwise, if not available, display a message stating such.

I want to click a button on a form that will run some routine to see if “z:\database\sidewalks.mdb” is available. If yes, then run a macro called “macTransfer”; if not available, display a message “Network file is not available”.

Thanks,
SKK

Reply With Quote
  #2  
Old January 31st, 2004, 10:48 AM
supersubra's Avatar
supersubra supersubra is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Aug 2003
Location: Coimbatore, India
Posts: 280 supersubra User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 10 sec
Reputation Power: 6
place the following function in one of your module


Public Function FileExists(Pathname, Filename) As Boolean
If Dir(Pathname & Filename) = Filename Then
FileExists = True
Else
FileExists = False
End If
End Function

and now you can place the following command on any event.
If FileExists("C:\", "SAI.TXT") Then

'DO SOMETHING

ELSE

'DO SOMETHING ELSE

ENDIF
__________________
V.Subramanian

Reply With Quote
  #3  
Old February 1st, 2004, 02:45 AM
OldJacques's Avatar
OldJacques OldJacques is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 10 OldJacques User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 40 m 55 sec
Reputation Power: 0
The example only checks if the file is present, but we had a case where periodically the Jet DB Engine didn't allow MS Access to be run, while the ASP page remained functioning and database remained present.
We solved it with a different solution, which checked if there was a successful connection:
Code:
<% Set conn =Server.CreateObject("ADODB.Connection")
conn.open "Provider=Microsoft.Jet.Oledb.4.0;data source ="&Server.MapPath("/database/test.mdb")
IF Conn.Errors.Count>0 or conn.state <> 1 THEN %>
<p align="center"><a href="back.asp">something went wrong<br /><br /><br />
Go back and try again</a></p><%
Else
'other stuff for good connection like your macro
End If %>
which of course could also be set up as a function if you prefer.

Reply With Quote
  #4  
Old February 3rd, 2004, 08:08 AM
esskaykay esskaykay is offline
Contributing User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 34 esskaykay User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 20 m 25 sec
Reputation Power: 5
Thanks all,
SKK

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseMicrosoft Access Help > Determine if file is available


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway
Stay green...Green IT