Code Confusion

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
 
D

Daniel Pineault

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.
 
D

DS

I tried this

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

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

Neither one worked.

Thanks

DS
 
D

Daniel Pineault

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.
 
D

DS

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
 
D

Daniel Pineault

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.
 
D

DS

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
 
D

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
 
D

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

No DLookUp 14
Move Files after import 1
If Statement 4
Relinking Tables with VBA code 4
Shell (Opening files) 7
listing directories in the Immediate Pane 2
Compacting BackEnd 4
Need Urgent Help on Strip Path 1

Top