Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10

    File address and extension

    Hello friends
    I have a file to import students' photos.
    I do not want to use dialogue.
    I have three fields in Table 1. Student code. student's name. Student photo address
    At the installation location there is a folder called one where the user has to put all the photos.
    With a query, I extract the location of the photo along with the name of the photo and place it in the address of the photo.
    As :
    [CurrentProject]. [Path] & "\ 1 " & [Table1]! [B] & ".jpg"


    But the question and the problem:
    If the user puts the photos in another format in the folder, it will not be placed in the address. What can I do to fix this problem or what is your suggestion?

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Look for other image formats?
    Make them use .jpg only?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Quote Originally Posted by Welshgasman View Post
    Look for other image formats?
    Make them use .jpg only?
    ==============
    I want the photos to be in any format and be included in the path along with the photo address.
    With this query, only GPG files are imported.
    How do I add other formats to the address?

  4. #4
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Quote Originally Posted by kolait View Post
    ==============
    I want the photos to be in any format and be included in the path along with the photo address.
    With this query, only GPG files are imported.
    How do I add other formats to the address?
    I want the photos to be in any format and be included in the path along with the photo address.
    With this query, only GPG files are imported.
    How do I add other formats to the address?
    Attached Files Attached Files

  5. #5
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    Why not filedialog???
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  6. #6
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Don't have time to download right now, but why not use something like Left(strThePath,Instr(strThePath,".") & Mid(strThePath,Instr(strThePath)+1) ?
    If I have that wrong, the logic is
    - get everything up to the period and use that for the first part
    - get everything after the period
    - concatenate those values
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  7. #7
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    I want to import photos for a thousand people ..
    With one-on-one dialogue, you have to choose which takes a lot of time

  8. #8
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Thanks for taking the time.
    I do not know these ..
    Can you help in the sample file format?

  9. #9
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,550
    So as micron infers, look for the . that separates prefix from suffix and hope all those files are graphical?
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  10. #10
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,879
    Tried to open your zip file but I get an error that it is empty or corrupt.
    If this helped, please click the star * at the bottom left and add to my reputation- Thanks

  11. #11
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Yes, everyone in the folder is graphic

  12. #12
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Turns out momma gave me a few minutes. Try this in your button click event
    Code:
    Private Sub Command45_Click()
    'MkDir CurrentProject.Path & "\photos"
    Dim Path1 As String, Path2 As String, FullPath As String
    
    FullPath = DLookup("h", "table2", "ID=1")
    MsgBox FullPath
    
    Path1 = Left(FullPath, InStr(FullPath, "."))
    Path2 = Mid(FullPath, InStr(FullPath, ".") + 1)
    
    
    MsgBox Path1 & Path2
    End Sub
    Both messages should be the same. First is just what's in the table for ID1. Second is the second part of the string concatenated onto the first part of the string. So if the pic is a gif, that's what you should get.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  13. #13
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Quote Originally Posted by moke123 View Post
    Tried to open your zip file but I get an error that it is empty or corrupt.
    File modified
    Attached Files Attached Files

  14. #14
    kolait is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2021
    Posts
    10
    Thank you, but it was not done

  15. #15
    Micron is offline Very Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    13,421
    Quote Originally Posted by kolait View Post
    Thank you, but it was not done
    That means what and was directed to whom?

    If I change the table record from jpg to gif, I get exactly what you seem to be asking for. If you're asking how to implement this once it's figured out, you didn't say that. If that's to be in a query, then don't specify the file extension in your query, just use LIKE Operator. I would have made a suggestion but in your example you use Table1.B but that field has nothing in it that resembles a picture file name or its extension.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. file format or extension not valid.
    By Homegrownandy in forum Programming
    Replies: 6
    Last Post: 02-05-2018, 07:24 AM
  2. Use FileDialog to get file with txt extension
    By newbieX in forum Programming
    Replies: 4
    Last Post: 01-11-2016, 07:28 PM
  3. Need to import .txt file using the extension only.
    By PJ Crittenden in forum Macros
    Replies: 3
    Last Post: 06-24-2014, 07:10 PM
  4. Replies: 1
    Last Post: 03-18-2014, 05:16 PM
  5. access file extension help
    By supertech33 in forum Access
    Replies: 2
    Last Post: 02-17-2010, 03:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums