use a variable as a pathname for Dir() function?

Tommy B

Registered User.
Local time
Today, 04:18
Joined
Feb 26, 2001
Messages
43
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\2003\"

strfullpath = strpath & strmth

strmyfile = Dir(strfullpath)


Thanks guys!

Tommy B
 
Thanks Wayne...I'll check it out :D
 

Users who are viewing this thread

Back
Top Bottom