Solved

need vb procedure/function

Posted on 2006-10-24
4
193 Views
Last Modified: 2011-09-20
How can I write a procedure that will check whether a user is connected to/ or can access a remote file share and if not pop up an alert window?
0
Comment
Question by:acdagirl
  • 2
  • 2
4 Comments
 
LVL 5

Accepted Solution

by:
lunchbyte earned 500 total points
ID: 17796453


I am thinking using the dir command.

untested function.


Function check_dir(str As String) As Boolean
       
    On Error GoTo er

    If Dir(str) <> "" Then
        check_dir = True
        ' no problem
    Else
        check_dir = False
        ' have access but found no dir
    End If


er:
    MsgBox "Say something here that they are not connected", vbCritical
End Function
0
 

Author Comment

by:acdagirl
ID: 17797122
i can use try/catch right? I'd rather not use goto statements...
0
 
LVL 5

Expert Comment

by:lunchbyte
ID: 17797137
You must be using vb.net. This is for vb6 the old stuff.

But yes, you can replace the gosub with try/catch.

http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/VB_DOT_NET/
0
 

Author Comment

by:acdagirl
ID: 17797149
no, I'm trying to use a macro in a word doc... so I guess try/catch doesn't work for vb6... ok. :-)
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

810 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