Code Confusion

  • Thread starter Thread starter DS
  • Start date Start date
D

DS

What exactly does this return, it's been awhile and I've seem to have
forgotten.
I'm using it to check a path if its valid. I keep getting INVALID PATH
even though I know the path is there.
Thanks
DS

strPath = \\Backoffice\BU\Data2.mdb

On Error Resume Next
If Len(Dir$(strPath)) > 1 Then
If Err.Number <> 0 Then
DoCmd.OpenForm "frmMsgSelect"
Forms!frmMsgSelect!TxtMsg = "INVALID PATH"
ElseIf Err.Number = 0 Then
End If
End If
 
The first thing I notice is the fact that your

strPath string variable is not in quotes.

Try

strPath = "\\Backoffice\BU\Data2.mdb"

--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 
I tried this

Me.TxtPath = Me.TxtStation & " " & \PRORED & "

I also tried "\\Backoffice\BU\Data2.mdb"

Neither one worked.

Thanks

DS
 
I changed it a bit, but this works fine.

Dim strPath As String
strPath = "\\Backoffice\BU\Data2.mdb"

On Error Resume Next
If Len(Dir$(strPath)) = 0 Then
DoCmd.OpenForm "frmMsgSelect"
Forms!frmMsgSelect!TxtMsg = "INVALID PATH"
Else
MsgBox "file found"
End If
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 
This really driving me crazy! I tried your suggestion but it doesn't work.
It should. My harddrive is petitioned, it has a C:\ and a D:\ drive does
this have anything to do with this? \\BACKOFFICE\PRORED is the directory
I'm checking...it worked before...but now....
Thanks, I appreciate your input.
DS
 
Perform a simple test. replace your strPath value with a file on your c:
drive and see what happens. If this works, which is should, as it works for
me, then you have an issue with your network drive.

Have you checked your network connections to ensure the network drive is
present and accessible by you?

Lastly, the function found at
http://www.cardaconsultants.com/en/msaccess.php?lang=en&id=0000000027#TestExtFile
is functional. So you may want to us it instead if you cannot get yours
functinal.
--
Hope this helps,

Daniel Pineault
For Access Tips and Examples: http://www.cardaconsultants.com/en/msaccess.php
If this post was helpful, please rate it by using the vote buttons.
 
I tried that, doesn't work. I'm on my local drive. The name of the
computer is BACKOFFICE
The drive is C:\ and the directory is PRORED... I get Error 52 if this
helps.
Thanks
DS
 
This works...
If Len(Dir$("c:\PRORED\Data2.mdb")) > 0 Then
MsgBox "Valid"
Else
MsgBox "Not Valid"
End If

This Doesn't
If Len(Dir$("\\BACKOFFICE\PRORED\Data2.mdb")) > 0 Then
MsgBox "Valid"
Else
MsgBox "Not Valid"
End If

DS
 
I'm convinced now that the problem is the partioned drive.
How do you code this?
\\BACKOFFICE\C:\PRORED\Data2.mdb
because if I use \\BACKOFFICE\PRORED\Data2.Mdb it doesn't know if it's the C
or the D drive. If I use C:\PRORED\Data2.mdb it doesn't know which
computer!!! What am I to do????!!!
Thanks
DS
 
Back
Top