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

    Just show some fields for input if checkbox is checked!

    Hi,



    I need your help for the below matter:

    I had a checkbox "OnCheck"on the main form:
    The following fields shall be visible if this checkbox is clicked.

    Fields are:
    Address
    City
    Country

    Else remains hidden on the form.

    On Report it shall show:

    If it is null then shall show "NA" otherwise the real input data.

    Kindly advise.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Options:

    1. use Conditional Formating to set the Enabled state of textboxes

    2. use VBA to set Visible or Enabled properties of textboxes, e.g.
    Me.tbxAddress.Visible = Me.chkShow = True

    On report, expression in textbox: =Nz([Address], "NA")
    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
    cap.zadi is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    May 2011
    Location
    KSA
    Posts
    481
    Set on format the fields Visible = No and then applied on click event of checkbox:

    Private Sub OnClickAddress_Click()
    Me.NAddress.Visible = Me.OnClickAddress = True
    Me.NCity.Visible = Me.OnClickAddress = True
    Me.NCountry.Visible = Me.OnClickAddress = True
    End Sub

    It works fantastic.

    Regarding the report:

    Its giving error #Size?

    Any advise?

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I have no idea why you would get that error in a textbox on report.
    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.

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

    Its done. Thanks

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

Similar Threads

  1. Checkbox checked
    By brandy in forum Programming
    Replies: 2
    Last Post: 01-11-2017, 01:07 AM
  2. Hide/Show fields at Form based on checkbox
    By cap.zadi in forum Forms
    Replies: 8
    Last Post: 04-22-2016, 05:08 AM
  3. If checkbox is checked allow query to run
    By burrina in forum Forms
    Replies: 14
    Last Post: 01-29-2013, 03:56 PM
  4. If checkbox is checked, add X to a current value
    By INeedAboutTreeFiddy in forum Programming
    Replies: 4
    Last Post: 05-30-2012, 08:17 AM
  5. Check-box to hide/show input fields
    By RapidFireGT in forum Forms
    Replies: 2
    Last Post: 12-05-2011, 05:55 PM

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