none
How to show picture in an access database and how can be showed conditionally in another form RRS feed

  • Question

  • I have two table

    1. tblImage

    2. tblCustomer

    In Tblimage table I have  Maleicon and Femaleicon. When we list ccustomer form , if the gender is Male then we have to display male icon otherwise female Icon. I cannot hard code  the path but it should be kept in a database.

    How can display the icon in attachment control of a form depends the customer gender. Please help


    polachan

    Monday, December 4, 2017 9:19 PM

All replies

  • Hi,

    If you want to use an Attachment field, then you can join the image table with the customers table for your form.

    Since you only have two images to show, it might be simpler to store the in the Image Gallery and then use code in the form's Current event to display the proper image using an Image control.

    Just my 2 cents...

    Monday, December 4, 2017 9:24 PM
  • Another option would be to use two unbound superimposed Image controls, one for each icon, and then hide/show the appropriate control on the basis of the value of the Gender column with code in the form's Current event procedure.  There would be no need to store the image files at all; you'd simply have to assign them to the controls when the controls are added to the form.

    The code would be along these lines:

        Me.FemaleImageControl.Visible = (Me.Gender = "Female")
        Me.MaleImageControl.Visible = (Me.Gender = "Male")

    If you put the same code in the Gender control's AfterUpdate event procedure the relevant image will be shown as soon as a value is entered in the control.

    Ken Sheridan, Stafford, England

    Monday, December 4, 2017 11:41 PM