Check if Folder Exists (1 Viewer)

Fornatian

Dim Person
Local time
Today, 06:49
Joined
Sep 1, 2000
Messages
1,396
Does anybody out there know how I can check if a folder exists on a PC(e.g.C:\Windows\MyAccessApp)
then if it does exist do nothing
otherwise create.

I'm sure this iswill be quite a long winded function but if anyone out there has done anything similar I would appreciate your help.

Thanks in advance

Ian
 

accesswatch

Registered User.
Local time
Today, 06:49
Joined
Aug 12, 2000
Messages
72
Try this

dim MyDir as string
MyDir = "C:\Windows\MyAccessApp\."

if Len(Dir$(Mydir,vbDirectory)) > 0 then
'Dir exisits
else
'does not exist
' You create dir code here
end if

Make sure that you include the \. as this indicates you are looking for a directory
Hope this helps
Regards
Trevor from www.accesswatch.co.uk
 

Fornatian

Dim Person
Local time
Today, 06:49
Joined
Sep 1, 2000
Messages
1,396
Just what I was after.
Penelope Pitstop(or Trevor from AccessWatch)
"You're my Hero" :)

Just goes to show that sometimes what you think is going to be dead hard but isn't makes forums like this worthwhile.

Cheers
 

Users who are viewing this thread

Top Bottom