Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409

    Button image in continuos form

    Hi,
    i have a calendar table in which i have the yes/no field called "completed"



    i made a continuos form based on a query of the table "calendar", i'd like to add a button to eery row that changes image if the value is completed or not completed (the "completed" field is either yes or no)

    is there any way

  2. #2
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,801
    Pretty sure this is a property that you cannot set on individual buttons. In a continuous form there is only one of each control but you see many instances of it. Data controls can take on some individual characteristics/formatting, but not embedded pics in buttons. So the short answer would be no.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    there must be a long answer.
    i always find it
    stay tuned

  4. #4
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Agree with the short answer given by Micron.
    As for the long answer, what you can do is use conditional formatting on each record so, for example, Yes is shown in green and No in red.
    Or you can use an IIf expression to display a tick if Completed=Yes and a cross if No. Both can be colour formatted using CF as above
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  5. #5
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    I used this trick.
    i made a new table with 2 fields, the first is a Yes/no, the second is an attachment.

    i used this table in my query and i linked the "completed" field of calendar table to the "yes/no" field in the new table, so it returns a different image if the completed is yes or no.

    i enabled the attachment control and i blocked it so when i click on it it doesn't show the small attachment icon used to add the attachment itself.

    works greatly

  6. #6
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Congratulations...perhaps you would like to upload an example.
    However, wouldn't either of the solutions I suggested have been much simpler?
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  7. #7
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    you're right...but i liked the idea of images... pretty beautiful and it's very fast; however, i tried to use your solution but when in "open form" event i tried to use your solution "IIf expression to display a tick if Completed=Yes and a cross if No" it gave me the error "recordset not updatable", and i click on it to start the update query that update to true/false the task
    this is the demo
    Attached Files Attached Files

  8. #8
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    One more long answer:
    (Take a look in the frmCalendar of ButtonImages.accdb in attachment)
    Attached Files Attached Files

  9. #9
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Sorry. Only just had time to look at the test file.
    Yes it works but attachments will rapidly 'bloat' database size if you have many records and so are best avoided.
    If you really must use an image, I would instead store two small image files in the image library and reuse them repeatedly.

    The later example by @accesstos is similar to my suggestion and I prefer that approach
    The only thing I not keen on is the default Red x value showing on new records

    I've just remembered a thread by CJ_London ag another forum that you may find useful.
    https://www.access-programmers.co.uk...eckbox.305659/
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  10. #10
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Hi Colin!

    Quote Originally Posted by isladogs View Post
    The only thing I not keen on is the default Red x value showing on new records
    Can be hidden using this expression: =IIf(IsNull([ID]);"";IIf([Completed];"ü";"û"))

    Furthermore, we can use html in a Rich Text textbox if need different type of results (symbol/text) in any condition. For example, with an expression like this:

    =IIf([Completed];"<FONT face=Wingdings size=6 color=green>ü</font>";"<b>No</b>")


    we get a green tick in case of "Completed" and the red word "No" in the opposite case:

    Click image for larger version. 

Name:	buttonImages.JPG 
Views:	32 
Size:	34.7 KB 
ID:	43204

    Cheers,
    John

  11. #11
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    Hi John
    Yes I've done that myself on several occasions and it works well. In fact it was what I was alluding to in post #4.
    Many thanks for going the 'extra mile' and demonstrating it!
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  12. #12
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    very nice. Right now i have just two small images but the example is very good, i'll give a look this we

  13. #13
    isladogs's Avatar
    isladogs is offline MVP / VIP
    Windows 10 Access 2010 32bit
    Join Date
    Jan 2014
    Location
    Somerset, UK
    Posts
    5,977
    @diegomarino.
    Yes because you only have two records, However, you are adding an attachment for each record.
    Even if you keep using the same two images on each record, you will be adding them repeatedly causing file bloat and slowing down your app
    Colin, Access MVP, Website, email
    The more I learn, the more I know I don't know. When I don't know, I keep quiet!
    If I don't know that I don't know, I don't know whether to answer

  14. #14
    diegomarino is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Feb 2018
    Posts
    409
    I used the shortest path...just made a textbox that if the task is completed i see a checkmark, if not completed a "x", and i used a click event to change the status

    since those are textboxes the cursor stuck in it, i just solved setting the focus in another control, is there any way to make a textbox behave just like a button?

  15. #15
    accesstos's Avatar
    accesstos is offline Expert
    Windows XP Access 2007
    Join Date
    Dec 2018
    Location
    Greece
    Posts
    551
    Good choice Diego!

    You can put a transparent button over the textbox and build your code in button's OnClick event. Set the textbox properties: Locked=Yes, Enabled=No.

    Tip: Choosing the "Rich Text way", you avoid the CF and have more freedom about the message to display.

    Good luck with your project!

    John

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

Similar Threads

  1. Problem on setting source in continuos form
    By diegomarino in forum Access
    Replies: 7
    Last Post: 05-10-2020, 06:32 PM
  2. continuos form not more refreshing
    By diegomarino in forum Access
    Replies: 7
    Last Post: 05-05-2020, 09:52 AM
  3. filters in continuos form using VBA code
    By TriFith in forum Access
    Replies: 5
    Last Post: 01-11-2017, 04:48 AM
  4. Sum textbox in continuos form
    By cuongmyh in forum Forms
    Replies: 2
    Last Post: 02-27-2015, 10:12 AM
  5. Replies: 1
    Last Post: 06-21-2013, 10:41 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