Results 1 to 6 of 6
  1. #1
    Thomasso is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250

    Conditional image in a continuous form

    Hello,

    I have the sales order details form below...

    I have 3 icons in PNG (red, yellow, green) as indicated by the arrows. I want to display an icon based on the number in the text field (if 0, then red, if more than 0 and less than total, then yellow, if equals total, then green).

    I can't seem to make this work, there is always the same icon display for all the records. Can you please help me how to achieve this?

    Thank you,
    Tomas

    Click image for larger version. 

Name:	form.png 
Views:	22 
Size:	58.1 KB 
ID:	50262

  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,399
    what code are you using?

  3. #3
    Thomasso is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250
    Quote Originally Posted by CJ_London View Post
    what code are you using?
    I thought I would use IIF in the image control source.

    Code:
    =IIF([Qty]=0;"/images/icon_red.png";"/images/icon_yellow.png")
    (simplified)

  4. #4
    Gicu's Avatar
    Gicu is online now VIP
    Windows 10 Access 2013 32bit
    Join Date
    Jul 2015
    Location
    Kelowna, BC, Canada
    Posts
    4,101
    I don't think using the control source will work as that is only evaluated for the current record; you need to use conditional formatting in a control and change its font or background colors.

    Cheers,
    Vlad Cucinschi
    MS Access Developer
    http://forestbyte.com/

  5. #5
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,399
    you need to include the full path - this works for me as a quick example in a continuous form - use your own formula

    ="D:\Dev\Images" & IIf([pwpk] Mod 2=0,"ALLogo.jpg","brushedsteel.PNG")
    Click image for larger version. 

Name:	image_2023-05-23_182328719.png 
Views:	19 
Size:	32.4 KB 
ID:	50264

  6. #6
    Thomasso is offline Competent Performer
    Windows 10 Office 365
    Join Date
    Nov 2016
    Location
    Czech Republic
    Posts
    250
    Quote Originally Posted by CJ_London View Post
    you need to include the full path - this works for me as a quick example in a continuous form - use your own formula

    ="D:\Dev\Images" & IIf([pwpk] Mod 2=0,"ALLogo.jpg","brushedsteel.PNG")
    Click image for larger version. 

Name:	image_2023-05-23_182328719.png 
Views:	19 
Size:	32.4 KB 
ID:	50264
    Thank you, this works!

    My formula if anyone finds it helpful:
    Code:
    ="\\srv01\ISDATEL$\graphics\icons\" & IIf([QuantityReserved]=0;"flag_0percent.png";IIf([QuantityReserved]>0 And [QuantityReserved]<[Quantity];"flag_50percent.png";IIf([QuantityReserved]=[Quantity];"flag_100percent.png";"")))
    Result:

    Click image for larger version. 

Name:	form2.png 
Views:	14 
Size:	16.0 KB 
ID:	50268

Please reply to this thread with any new information or opinions.

Similar Threads

  1. An image in Continuous Form View
    By MatthewGrace in forum Access
    Replies: 2
    Last Post: 11-13-2020, 06:40 AM
  2. Replies: 5
    Last Post: 02-13-2019, 05:03 PM
  3. Replies: 2
    Last Post: 12-22-2012, 07:49 AM
  4. Replies: 3
    Last Post: 10-12-2012, 01:38 PM
  5. Replies: 7
    Last Post: 10-01-2012, 07:59 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