View Full Version : use a variable as a pathname for Dir() function?


Tommy B
09-03-2003, 10:20 AM
Hi All,

Well I'm getting quite into vba now...not any good, but its addictive :D

I'm trying to write a little procedure that checks for the existance of various files in a directory. The files will be stored in different named folders dependant on month i.e. jan, feb, mar, etc.

What I want to do is have the user type in the month name and then pass that into the Dir() function.

Here's what I have/am trying...probably a silly way of doing it so if any kind soul can enlighten me that would be great :p

Option Compare Database
Option Explicit

Public Sub check_files()
Dim strmyfile As String
Dim strmth As String
Dim strpath As String
Dim strfullpath As String


strmth = [Forms]![frmandy]!Month

strpath = "\\G0100051\Planning_RealEstate\Dailys\ascprints\20 03\"

strfullpath = strpath & strmth

strmyfile = Dir(strfullpath)


Thanks guys!

Tommy B

WayneRyan
09-03-2003, 10:22 AM
Tommy,

Maybe this link will help. See ghudson's links:

http://www.access-programmers.co.uk/forums/showthread.php?s=&threadid=52914&highlight=browse+and+wayne

Wayne

Tommy B
09-04-2003, 01:20 AM
Thanks Wayne...I'll check it out :D