Free Lessons
Courses
Seminars
TechHelp
Fast Tips
Templates
Topic Index
Forum
ABCD
 
Home   Courses   Templates   Seminars   TechHelp   Forums   Help   Contact   Join   Order   Logon  
 
Home > TechHelp > Directory > Access > Images < Not Updateable | Table-Level Validation >
Back to Images    Comments List
Upload Images   @Reply   Bookmark    Link   Email  
Use Wildcard in Query for Multiple File Types
Lisa Snider 
       
5 months ago
I am implementing Richard's procedure to save images in a folder under the database folder.  The problem is, of the over 700 images I have, half are .jpg, the other half  .png. Is there a way to use wildcards in a concatenated string in a query?  Do I have to choose one file type over another and convert the other images? Or is there a third choice that (right now) is beyond me?   I'm sure the eventual users of my database will encounter the same issue.  

My query code now is:
ProductImage: [CurrentProject].[Path] & "\ProductImages\" & [ManufactureStock#] & ".PNG"

Thank you for taking a look.  >^..^<
Kevin Robertson  @Reply  
          
5 months ago
Add this to a Global Module:

Function GetImagePath(ManufactureStockNum As String) As String

    Dim FolderPath As String, FileName As String

    FolderPath = CurrentProject.Path & "\ProductImages\"
    FileName = Dir(FolderPath & ManufactureStockNum & ".*")
    
    If FileName <> "" Then
        GetImagePath = FolderPath & FileName
    Else
        GetImagePath = ""
    End If
    
End Function


You can then call this function from anywhere in your database, including your Query.
Lisa Snider OP  @Reply  
       
5 months ago
Thanks Kevin, but I'm confused.  

How does this module relate to the query I've written?
Kevin Robertson  @Reply  
          
5 months ago
Call the function in your Query to get the full path including the appropriate extension.

   ProductImage: GetImagePath([ManufactureStock#])

Note: I wouldn't use special characters in your field names.

Watch this video: Create Function
Lisa Snider OP  @Reply  
       
5 months ago
THANK YOU, KEVIN!  You are the GOAT!  (Sorry Richard)

This works perfectly.  (I got rid of the # sign... guess I wasn't thinking of the problems it could cause when I first named the field. Thanks for pointing it out.)

This thread is now CLOSED. If you wish to comment, start a NEW discussion in Images.
 

 
 
 

The following is a paid advertisement
Computer Learning Zone is not responsible for any content shown or offers made by these ads.
 

Learn
 
Access - index
Excel - index
Word - index
Windows - index
PowerPoint - index
Photoshop - index
Visual Basic - index
ASP - index
Seminars
More...
Customers
 
Login
My Account
My Courses
Lost Password
Memberships
Student Databases
Change Email
Info
 
Latest News
New Releases
User Forums
Topic Glossary
Tips & Tricks
Search The Site
Code Vault
Collapse Menus
Help
 
Customer Support
Web Site Tour
FAQs
TechHelp
Consulting Services
About
 
Background
Testimonials
Jobs
Affiliate Program
Richard Rost
Free Lessons
Mailing List
PCResale.NET
Order
 
Video Tutorials
Handbooks
Memberships
Learning Connection
Idiot's Guide to Excel
Volume Discounts
Payment Info
Shipping
Terms of Sale
Contact
 
Contact Info
Support Policy
Mailing Address
Phone Number
Fax Number
Course Survey
Email Richard
[email protected]
Blog RSS Feed    YouTube Channel

LinkedIn
Copyright 2025 by Computer Learning Zone, Amicron, and Richard Rost. All Rights Reserved. Current Time: 7/20/2025 1:47:23 AM. PLT: 1s