Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to open a sub sub directory through Access VBA

Status
Not open for further replies.

LoriCapital

Programmer
Aug 26, 2011
1
US
I am trying to open a sub sub directory through Access VPA so that it will open the following folders:

\\maps and attachments\alternates\Yuma - CA \ RingID - Search
main dir sub dir sub dir sub dir

I already have the part where you create the directories, but my problem is that I can't get it to open the final sub dir (which are 2 separate fields in access). I have this working up to sub sub directory. Please note that after the "alternates" part the rest change based on each records information. Below is the code of what I have so far. I hope you can help as my db is almost up to 2 GB
Dim RetVal, myPath As String

On Error GoTo BadFolder

myPath = "C:\WINDOWS\EXPLORER.EXE U:\Maps and Attachments\Alternates\" & B_8 & " - " & B_9

RetVal = Shell(myPath, 1)
GoTo DoneIt

BadFolder:

MsgBox ("Please Create the Folders for this Job")
DoneIt:
 

Are you trying to get to "Yuma - CA" folder? Or to "RingID - Search" folder?
Code:
Dim RetVal As Double, myPath As String
Dim B_8 As String
Dim B_9 As String

B_8 = "Yuma"
B_9 = "CA"

On Error GoTo BadFolder

myPath = "C:\WINDOWS\EXPLORER.EXE U:\Maps and Attachments\Alternates\" & B_8 & " - " & B_9

Debug.Print myPath[green]
'myPath: 
'C:\WINDOWS\EXPLORER.EXE U:\Maps and Attachments\Alternates\Yuma - CA[/green]

RetVal = Shell(myPath, 1)

Have fun.

---- Andy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top