Results 1 to 3 of 3
  1. #1
    Secue is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    33

    Smile Show or hide a comment based on a field information


    I have a form using fields from a table. One field is a Yes/No type. I need to show a message that stays on the form if the YES/NO field is True, if the field is false I want to hide this comment. I tried adding the coment as a label. When I open the form I want to evaluate the YES/NO field. If it is true I want show the alert message on the form (I do not want to use a msgbox) and need this message visible all the time that the user is working on the form. If value of the field is False, then I just do not want to show the alert message.

    Not sure if I'm clear on my need.

    I think I can do it changing the property of the label, but not sure how to do it on VBA.

    Thank you.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,933
    Changing control properties with VBA will not work nice with Continuous or Datasheet view. The change will be reflected in ALL records because there really is only one control.

    If the form is Continuous or Datasheet, create a field with expression in a query that serves as the form RecordSource.

    AlertMsg: "Your message here."

    Bind a textbox to this calculated field. Use textbox Conditional Formatting to set ForeColor same as BackColor.

    Otherwise, VBA:

    Me.labelname.Visible = Me.checkbox

    The real trick is figuring out what event(s) to put the code in. Maybe the form Current and/or the checkbox AfterUpdate.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    Secue is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2013
    Posts
    33
    Thank you. second option worked for me.

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

Similar Threads

  1. Replies: 7
    Last Post: 02-20-2014, 01:24 PM
  2. Replies: 3
    Last Post: 01-14-2014, 04:17 PM
  3. Show/ hide image based on some field value
    By capitala in forum Reports
    Replies: 4
    Last Post: 04-06-2013, 10:56 AM
  4. show / hide columns based on criteria?
    By stevepcne in forum Access
    Replies: 1
    Last Post: 11-18-2011, 02:49 PM
  5. Replies: 6
    Last Post: 02-24-2011, 03:24 PM

Tags for this Thread

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