strRetPathName = Dir(strPathName, [attributes])

if checking for a directory then...

strRetDirName = Dir(strPathName, vbDirectory)

if strRetPathName = "" then
   Directory does not exist
else
   strRetPathName will equal the Directory Name

i.e.  "C:\Temp\Work" it returns "Work"

Note: if you supply...

      "C:\Temp\Work\" it returns "."

--- Dennis Mahoney <[EMAIL PROTECTED]> wrote:

> I am using OutputTo to write a file to our network
> and I would like to know
> how to error check that the computer is attached to
> the network and that the
> specified folder is available. I use the commands
> below 
> ==================
> 'File will be named with drive+path+rm#+revised+rev
> date.snp
> pstCriteria = "[rm#] = Me![rm#]"
> stDocName = "rpt R1"
> 'stPath = "e:\" 'use for testing when not connected
> to network
> stPath = "s:\rm specifications\R1 changes and
> additions\" 'network drive and
> folder where R-1s are stored
> 'Construct the date because format of [rev date] can
> include / which is not
> allowed in file name
> stDateStamp = " revised " & Month(Me![sfrm R-1]![rev
> date]) & "-" &
> Day(Me![sfrm R-1]![rev date]) & "-" & Year(Me![sfrm
> R-1]![rev date]) 'append
> revision date to saved file
> stFileName = stPath & Me![RM#] & stDateStamp &
> ".snp"
> Refresh
> DoCmd.OutputTo acReport, stDocName, acFormatSNP,
> stFileName
> Exit Sub
> ===============================================
> 
> This works fine when stPath specifies an available
> path but if the path is
> not available then I get an error message which I
> can clear but which brings
> up another error message. Clearing that error
> message sends me back to error
> message 2 and the only way I know to get out of this
> is to close the program
> from task manager. 
> My question is then whether there is a way to check
> for the existence of
> stPath so I can bypass the outputTo command when the
> path is not available. 
> 
>  
> 
> Any help would be greatly appreciated.
> 
>  
> 
> Thanks,
> 
>  
> 
> Dennis
> 
>  
> 
>  
> 
>  
> 
> 
> 
> [Non-text portions of this message have been
> removed]
> 
> 
> 



 
____________________________________________________________________________________
Low, Low, Low Rates! Check out Yahoo! Messenger's cheap PC-to-Phone call rates 
(http://voice.yahoo.com)



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AccessVBACentral/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/AccessVBACentral/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to