Page 2 of 2 FirstFirst 12
Results 16 to 22 of 22
  1. #16
    LeonS is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2014
    Posts
    115
    Quote Originally Posted by LeonS View Post
    Minty - thanks for that. I still cannot get it to work!
    In the Master1 table there is a field called “ImageName”. In the Settings table there are 2 fields, the IDSettings and “ImagePath”. In the Query called “PhotoNameQ”, there are 2 tables ‘Settings’ and ‘Master1’. They are not linked, although there is a field called “IDSettings” in both.
    In the Query “PhotoNameQ” there is a concatenated field containing the following:


    “PhotoName: [ImagePath] & [ImageName]”
    In the Contacts form, where the image is to appear, there is a TextBox called “ImageName” which feeds the Master1 table. The ImageName is, typically, “JohnSmith.JPG”.
    In the Contacts form there is an ImageBox called “Image262”. The Data Control Source of that ImageBox contains the following:
    “DLookup("[PhotoName]", "PhotoNameQ", "[IDMaster1] = " & IDMaster1)” – which you should recognise as the information you sent me.
    But it does not work. I am still learning, so any help would be appreciated. What am I doing wrong? Leon
    Minty - This is extra because I cannot get a regular reply box to appear on screen!!

    The latest DLookup I have tried makes sense to me but not to Access! It is:

    DLookup("[PhotoName]", "PhotoNameQ", "[IDMaster1] = "'Image268'")

    This is explained, thus:
    PhotoName is the complete Path including the basic path + the specific jpg file name belonging to each record. The source of this text is from PhotoNameQ - which is a Query (not a table) generating, by concatenation, the 'full path'.
    IDMaster1 is the table where the jpg file name is entered and stored, taken from a TextBox on the Contacts form.
    Image268 is the ImageBox in which the JPG should be appear.

    I believe the full stops, commas, brackets etc are in the correct place. Do you have any comments, please? Leon

  2. #17
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    Idmaster1 should be the name of the field for the criteria.
    Image268 is the criteria.

    So you have got it wrong?
    You would also need to concatenate the value of the criteria to the criteria field.
    https://support.microsoft.com/en-us/...b-bed10dca5937
    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. #18
    LeonS is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2014
    Posts
    115
    Welshgasman - Thanks for that! I will work on that today. Leon

  4. #19
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    4,861
    You might want to start giving controld some meaningful names as well?

    Your code should be something along the lines of
    Code:
    Me.Image268.Picture = DLookup("FieldThatHoldsThePath","TblWhereThePathsAreStored","FieldThatHoldsID = " & Me.ControlThatHoldsIDValue
    You could even set the Picture property with the DLookUp() using the fieldname for ControlThatHoldsValue
    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

  5. #20
    LeonS is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2014
    Posts
    115

    DLookup Problem Solved!

    Welshgasman - thanks for that and sorry for my delay in replying!! To be honest, I have given up on trying to get DLookup to work. I am ssure it is a great system but I cannot get it to work. I am using a completely different system.
    To get the image to show in the ImageBox, I have to deliver the complete Path. I want to reduce the amount of input the user has to provide. I want the user just to input the image file name (eg JohnSmith.jpg). To do this I use 2 invisible text boxes on the form. Then I concatenate them into the required Control Source. The first text box contains the default path to the first part of the path (eg C:\PeopleImages\). The user inputs the file name (eg JohnSmith.jpg) into the ImageName. I then add the 2 together to give the complete path. And it works. It may not be perfect, it may not be industry standard. But it works. Thank you for your patience and contribution. Leon

  6. #21
    Join Date
    Oct 2021
    Posts
    9
    Not sure if someone mentioned this or not, but you could have a search bar in your app. Then let the user type keywords and click on search. Then your query do a wildcard search and the app returns the path to display image.

    This way users don’t need to know the exact file name but close enough for your query to determine the closest file.

    if it’s not clear, I could create a prototype for you to review the whole access database.

  7. #22
    LeonS is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2014
    Posts
    115
    MikeyLovesAccess - thanks for that. I do not plan to have a search bar in my app as there is access (pardon the pun) to Google on all the main pages. But interesting idea! My app is nearly finished but there are just one or two things I have get working properly and then I can change my focus to "packaging" the app. Thanks - Leon

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

Similar Threads

  1. Replies: 10
    Last Post: 02-25-2019, 07:36 PM
  2. Replies: 2
    Last Post: 08-22-2018, 12:15 PM
  3. Replies: 6
    Last Post: 03-22-2018, 12:02 PM
  4. Replies: 7
    Last Post: 02-07-2017, 05:19 PM
  5. Replies: 1
    Last Post: 12-26-2016, 08:57 AM

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