Solved

read-only access

Posted on 2002-04-23
2
142 Views
Last Modified: 2010-05-02
Hai,

I'm using the functions below to find some directory in which a user has write access. However, in a map with 50 subdirectories where the user only has write access to 5 of them I find the procedure to slow.

Does someone know a quicker way to check for write access to the sub maps?

(BTW, yes, most of the functions came out of VBA help files  ;-)   )

Function Make_List() As String
Dim MyPath As String, MyName As String, maplist As String
  MyPath = "f:\data\"
  MyName = Dir(MyPath, vbDirectory)
  Do While MyName <> ""
    If MyName <> "." And MyName <> ".." Then
      If (GetAttr(MyPath & MyName) And vbDirectory) = vbDirectory Then
            If check_access(MyPath & MyName & "\") Then maplist = maplist & "," & MyName
      End If
    End If
    MyName = Dir
  Loop
  Make_List = Right(maplist, Len(maplist) - 1)
End Function

Private Function check_access(pad As String) As Boolean
  On Error GoTo handler
  Open pad & "TESTFILE" For Output As #1
  Close #1
  Kill pad & "TESTFILE"
  check_access = True
  Exit Function
handler:
  check_access = False
End Function

Kind regards
0
Comment
Question by:ehout
2 Comments
 
LVL 3

Accepted Solution

by:
Elmo_ earned 150 total points
ID: 6962315
ehout,

If you goto the following website you should get everything you need and more.

http://www.allapi.net/apilist/apifunction.php?apifunction=GetFileSecurity

This API should allow you to identify the security type on the folders you are checking.

There is also an example of how to get the Security Type and Change it.

Hope this helps.

0
 
LVL 3

Author Comment

by:ehout
ID: 7069801
Hi,

Indeed it seems to do the trick. However I'm not a hardcore programmer (though willing to learn). Could you or someone please tell me how to use that function?

The ntfs example seems a bit complex to me.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…

705 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

20 Experts available now in Live!

Get 1:1 Help Now