Results 1 to 9 of 9
  1. #1
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    Hide/Show fields at Form based on checkbox

    Hi Every One

    I am looking forward to apply the code to hide/show up the fields at a form based on the click (Yes) at the Yes/No check box field.

    There are many fields at the form but we will discuss here the relevant ones:

    CustomerReturns (Yes/No)
    CustomerName
    CustomerProject

    If i click at "CustomerReturns" as (Say Yes) then other two fields must show up else hidden.



    Kindly advise the needful.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481

    Thumbs up

    Hi, Thanks.

    I find this code which works perfect while fixing at after-update and at click events.

    Private Sub CustomerReturns_Click()


    Me.CustomerName.Visible = (Me.CustomerReturns = True)
    Me.CustomerProject.Visible = (Me.CustomerReturns = True)

    End Sub

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Yes, that uses Boolean logic to do the same thing, but many people don't understand it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hi, Thanks

    Can you check my another thread please.

    https://www.accessforums.net/showthread.php?t=59368

  6. #6
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Hello Boss

    I noticed that this Boolean logic works perfect only when form is uploaded for the new transaction otherwise the both hidden fields remains visible during next transactions until the form is closed and again opened for the new transaction.

    Kindly advise.

  7. #7
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Did you read the link, about the current event?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #8
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Well, yeah i read it but dont understand how to apply this code from my perspective. Can you advise according my data details.

  9. #9
    nhorton79 is offline Advanced Beginner
    Windows 8 Access 2007
    Join Date
    Apr 2015
    Posts
    34
    What pbaldy was trying to point you to was to put the code in the 'current' form event which triggers when a form changes record.

    See this link to clarify the current event for a form:
    https://msdn.microsoft.com/en-us/lib.../ff193159.aspx



    Sent from my iPhone using Tapatalk

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

Similar Threads

  1. Replies: 1
    Last Post: 07-16-2015, 11:55 PM
  2. Replies: 1
    Last Post: 11-26-2014, 02:30 PM
  3. Show/Hide Fields based on criteria.
    By jtm013 in forum Queries
    Replies: 6
    Last Post: 08-14-2014, 08:05 AM
  4. Replies: 7
    Last Post: 02-20-2014, 01:24 PM
  5. Replies: 3
    Last Post: 01-14-2014, 04:17 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