Re: wildacard character



Hi Allen,

yeah the picture name is known but the sub folder is not known(sorry if I
was unclear). So what I would like is to browse the CD to fine the file name
required.
Would you know how I can do this??

Thanks for your help!
--
Phil


"Allen Browne" wrote:

There probably is a simple solution.

But there might need to be some kind of consistent way of identifying folder
and file name for any particular record, so you know what picture needs to
be shown.

Your example suggests that the field named [driver_rec] contains the file
name, but your original post implies that the folder is unknown.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil" <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:89951E75-8183-4FCB-A6BA-D70F50E5B9F2@xxxxxxxxxxxxxxxx

I am not sure if this is what I need. U see I have a form created that
basically displays a staff picture from a CD.

The code that I have entered in the on current in the form properties is:

Private Sub Form_Current()


If Dir("c:\" & Me![driver_rec] & ".jpg") = "" Then

Me![ImageFrame].Picture = "c:\NoImage.jpg"
MsgBox "Picture doesn't exist for this User!!!"
Else
Me![ImageFrame].Picture = "e:\" & Me![driver_rec] & ".jpg"
End If

End Sub

so basically what i need is for the image to open when the picture is
found.
except the record is located in a subfolder and I do not know the name as
they are scanned by an external company and it is different on each CD.

I would be delighted if a simple solution exists

Thanks

--
Phil


"Allen Browne" wrote:

The example below shows how to list files in a folder and subfolders:


Public Function ListFiles(strPath As String, _
Optional strFileSpec As String, _
Optional bIncludeSubfolders As Boolean)
On Error GoTo Err_Handler
'Purpose: List the files in the path.
'Arguments: strPath = the path to search.
' strFileSpec = "*.*" unless you specify differently.
' bIncludeSubfolders: If True, returns results from
subdirectories of strPath as well.
'Method: FilDir() adds items to a collection, calling itself
recursively for subfolders.
Dim colDirList As New Collection
Dim vItem As Variant

Call FillDir(colDirList, strPath, strFileSpec, bIncludeSubfolders)

'List the items. (Or, you could add them to a list box.)
For Each vItem In colDirList
Debug.Print vItem
Next

Exit_Handler:
Exit Function

Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description
Resume Exit_Handler
End Function

Private Function FillDir(colDirList As Collection, _
ByVal strFolder As String, _
strFileSpec As String, _
bIncludeSubfolders As Boolean)
'Build up a list of files, and then add add to this list, any
additional
folders
Dim strTemp As String
Dim colFolders As New Collection
Dim vFolderName As Variant

'Add the files to the folder.
strFolder = TrailingSlash(strFolder)
strTemp = Dir(strFolder & strFileSpec)
Do While strTemp <> vbNullString
colDirList.Add strFolder & strTemp
strTemp = Dir
Loop

If bIncludeSubfolders Then
'Build collection of additional subfolders.
strTemp = Dir(strFolder, vbDirectory)
Do While strTemp <> vbNullString
If (strTemp <> ".") And (strTemp <> "..") Then
If (GetAttr(strFolder & strTemp) And vbDirectory) <> 0&
Then
colFolders.Add strTemp
End If
End If
strTemp = Dir
Loop
'Call function recursively for each subfolder.
For Each vFolderName In colFolders
Call FillDir(colDirList, strFolder &
TrailingSlash(vFolderName),
strFileSpec, True)
Next vFolderName
End If
End Function

Private Function TrailingSlash(varIn As Variant) As String
If Len(varIn) > 0& Then
If Right(varIn, 1&) = "\" Then
TrailingSlash = varIn
Else
TrailingSlash = varIn & "\"
End If
End If
End Function

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Phil" <Phil@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CC5BD465-EACF-429B-818B-F4C6569617F4@xxxxxxxxxxxxxxxx
Hello again,

What could I use to perform the following.

I have a CD with data on it except its not all in one directory

eg:

E:\Pictures\021\
E:\Pictures\022\
E:\Pictures\023\
E:\Pictures\054\

The problem is that I have many CD's with at pictures with various sub
directories.
Is there a wildcard character that I could use to substitite for the
folder
name?



.



Relevant Pages

  • Re: wildacard character
    ... the file names and folder names. ... and file name for any particular record, so you know what picture ... Public Function ListFiles(strPath As String, ... Dim strTemp As String ...
    (microsoft.public.access.formscoding)
  • Re: exif data from jpgs
    ... Sub dirTest() ... Dim dlist As New Collection ... Dim strTemp As String ... ' now process each folder (recursion) ...
    (microsoft.public.access.modulesdaovba)
  • Re: Outlook Express wont forward
    ... I chose a picture under Documents & Settings on the hard drive. ... MS MVP - Outlook Express ... I use AVG and have had e-mail scanning turned of since day one. ... folder. ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)
  • Re: Windows Explorer - Thumbnail Views
    ... If, on the right click menu, Preview is listed first and in BOLD letters, than double clicking a picture file will open Preview as the default option. ... Preview usually opens the Windows Picture and Fax Viewer, unless there is some third party application that takes its place. ... Select all of the thumbnails in your problem folder, then right click and select Refresh Thumbnail. ... Thumbs.db files contains the thumbnails for a particular folder. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Hyperlinks
    ... folder on the same root level as my index.htm & index_file. ... labeled each picture only to realize that on mouseover it just said "picture" ... Now use this code snippet: ... the link points to a webpage and the IMG points to an image ...
    (microsoft.public.publisher.webdesign)