Button on form to open folder

M

Midget

Is there any way to open a folder from within a record on a form, that
will look at a field, and do a search through the folder location
looking for that name, regardless of what comes before or after it?
Basically I want to do a search using wildcards before and after the
field PR#.
Example.
Contract, PR#, Serial, Name
I have a folder named 555-RC, 0912301, 5674, Seals
I want my "Open Folder" Button to search that folder for *PR#* and
pull up the current records folder.
The code I have used is much more static, and doesn't really work
going backwards, only from here forward.

Private Sub OpenFolder_Click()
Dim FolderName As String
FolderName = Me![PR#] & ", " & Me![Serial] & ", " & Me![Name]
Dim ProjectPath
ProjectPath = "\\Server\Share\" & FolderName
Shell "c:\WINDOWS\explorer.exe """ & ProjectPath & "", vbNormalFocus
End Sub

I can have it search on any of the fields in the record, but the older
folders, thousands of them, did not necessarily follow the exact
naming scheme. However, the PR# is ALWAYS correct, this is why I want
to do something like I did above, which works, but allow it to search
for only PR# regardless of what comes before, or what follows it. I
am still new to this whole coding behind the forms thing, but think I
can get there with a little nudge. Thanks for all off your help.
 

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

Top