• invisible control on report

    • This topic has 3 replies, 3 voices, and was last updated 24 years ago.
    Author
    Topic
    #355954

    Invisible control on Report

    I have a report with an invisible control on it. The report is called Invoice and the control on is is also called Invoice. I have a very strange problem.When I perfom the code given below from a form, without the command for the printing, that is without DoCmd.printout acPages, 1, 1, acLow, 1, True
    Then the control becomes visible on the screen.
    However, if I include the comand for the printing and click for the event for the code,then
    this control is not visible on the screes,
    Even though it is printed and I can see it on the paper.I cannot explain myself why the control is not seen the screen but is printed.
    My whole code is the folowing

    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Dim paymentid As Control
    Set paymentid = Forms![FOrderInformation]![paymentid]
    paymentid = increment
    finvoicedate
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    Dim stLinkCriteria As String
    stDocName = “Invoice”
    stLinkCriteria = “Paymentid = ” & paymentid
    DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
    Reports![invoice]![invoice].Visible = True
    DoCmd.printout acPages, 1, 1, acLow, 1, True

    How can I make the control visible on the screen ?

    i will be grateful for any help

    Viewing 0 reply threads
    Author
    Replies
    • #525974

      I’m not quite following you. Do you want the control to always be visible? If so, open the report in design view and set the visible property of the control to true. Then you won’t have to set its visible property in code and it should always print out and be visible.

      • #525975

        Thank you for your attention. I have simplified the task.Actually i have several invisible controls on the report and they are made visible depending on the chosen mode of action, for example one control is called InvoiceNumebr and the other OrderNumber.So in case of an invoice the control InvoiceNumnber is made visible.The funny thing is that if i only wnat to open the report without printing it, i can see the control on the screen, but if add on the command to print, then the control is not seen on the screen even though that it is printed.
        Best regards
        Slav

        • #526088

          Slav,

          I suppose, it’s these 3 lines of your code:

          DoCmd.OpenReport stDocName, acPreview, , stLinkCriteria
          Reports![invoice]![invoice].Visible = True
          DoCmd.printout acPages, 1, 1, acLow, 1, True

          You make the control visible only _after_ showing the report on screen in preview mode. At this time the control is still invisible. When printing (=printout command), the report is opened again and the control set visible by Access. At least I imagine things so…

          You should set the Visible property in the report’s Open event – sort of other way around. You should have a control in your form you can reference in the report’s event procedure to know if it is an invoice or an order. Then you could write in the Report_Open procedure:

          If Forms![FOrderInformation]![ctlInvoiceOrOrder]= "Invoice" Then
          Me![invoice].Visible=True
          Me![order].Visible=False
          Else
          Me![invoice].Visible=False
          Me![order].Visible=True
          End If
          

          This way, you don’t have to worry about preview or print, the report should show the right fields.
          Hope this helps 🙂

    Viewing 0 reply threads
    Reply To: invisible control on report

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: