Hide / Unhide Picturebox or TextBox in MS Access Report Using Checkbox??

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ZKAHADI
    New Member
    • Aug 2020
    • 58

    Hide / Unhide Picturebox or TextBox in MS Access Report Using Checkbox??

    Hey buddies i create a form and a report i am using signature image on report through form i made a checkbox ... now anyone tell me please how to VBA code to hide or unhide the signature image in report ............. not in form......
  • twinnyfo
    Recognized Expert Moderator Specialist
    • Nov 2011
    • 3662

    #2
    This would require you to somehow send the state of the checkbox to the report. If your desire is to display/not display the signature image on a "per record" basis, then it might be easiest to have a yes/no field in one of your underlying tables. As you set the checkbox to either True or False (checked or unchecked) via your form, when you display the report, you would have to modify the OnFormat property of the section of the Report in which you have your signature image. Then, it is as simple as inserting this code:
    Code:
    Me.ImageControlName.Visible = Me.CheckBoxFieldName
    Of course, you need to modify that to reflect your actual Control and Field names.

    Hope this hepps!

    Comment

    • NeoPa
      Recognized Expert Moderator MVP
      • Oct 2006
      • 32662

      #3
      Your question makes no real sense. There is so much you need to explain, just to make the question make sense, and you just haven't.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        1. You can use the OpenArgs Argument of the OpenReport Method to accomplish this.
        2. Let's assume the following scenario:
          1. Report Name = Invoices
          2. The Check Box on the Current Form is named chkSignature
          3. You have an Image Control on the Invoices Report named imgSignature.
        3. You can now use the OpenArgs Argument of the OpenReport Method to transfer the State of chkSignature on your Form to the Invoices Report. The State of the Check Box can either be NULL, Checked, Un-checked.
        4. In the Click() Event of a Command Button I now Open the Report passing the State of chkSignature to it.
          Code:
          Private Sub cmdOpenReport_Click()
          DoCmd.OpenReport "Invoices", acViewPreview, , , acWindowNormal, IIf(IsNull(Me![chkShowSignature]), 0, Me![chkShowSignature].Value)
          End Sub
        5. In the Open() Event of the Report, I can now determine whether or not to display the Image Control (imgSignature).
          Code:
          Private Sub Report_Open(Cancel As Integer)
            Me![imgSignature].Visible = Me.OpenArgs
          End Sub
        6. The Code has been tested and is fully functional.

        Comment

        • ZKAHADI
          New Member
          • Aug 2020
          • 58

          #5


          as in image i made a checkbox on the report above the sign if i preview the certificate in report view then i check the checkbox the sign appear. in another image i made the checkbox on form above the sign if i check the checkbox then the sign appear on form.
          i code like this
          if check37 = click then
          me.Sign.visible = true
          else
          me.sign.visible = false

          same i code in report on another checkbox

          the problem is that i want to appear and disappear the sign on report not on form. i want to check / uncheck the checkbox on form and the sign appear and disappear on report.

          so i tried to code the form checkbox in vba like this

          Report![CertificatePrin t].Sign.visible = true
          else
          Report![CertificatePrin t].Sign.visible = false

          but this code is not working ...

          Comment

          • twinnyfo
            Recognized Expert Moderator Specialist
            • Nov 2011
            • 3662

            #6
            Both I and ADezii have given you viable options for solving this issue. It may be wise for you to pursue those avenues first, rather than inventing alternate options which ignore this advice and try to overcomplexify things.

            Both proposed solutions are rather simple, straightforward , tested, tried and true. I’d be glad to help you troubleshoot one of those options with you. So would ADezii, I am sure—or any of the other experts on this forum.

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              It appears that we need to go to 'Plan B' at this time. You have two viable Options here, one from twinnyfo, and the other from myself, both of which you apparently not considered. I am attaching a Demo for you which should clearly illustrate how this can be done. Select/De-select the Check Box on the Form, then click the Command Button to Open the Invoices Report. The Demo is self explanatory.
              [imgnothumb]https://bytes.com/attachments/attachment/10315d159714570 9/demo.jpg[/imgnothumb]
              Attached Files
              Last edited by twinnyfo; Aug 11 '20, 11:40 AM. Reason: put image inline

              Comment

              • ZKAHADI
                New Member
                • Aug 2020
                • 58

                #8
                thank you very much you solved my problem ADezii

                Comment

                • ADezii
                  Recognized Expert Expert
                  • Apr 2006
                  • 8834

                  #9
                  You are very welcome, good luck with your Project.

                  Comment

                  Working...