Results 1 to 4 of 4
  1. #1
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    invisible control on report

    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

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: invisible control on report

    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.
    Charlotte

  3. #3
    3 Star Lounger
    Join Date
    Jan 2001
    Posts
    254
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: invisible control on report

    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

  4. #4
    Lounger
    Join Date
    Apr 2001
    Location
    Stuttgart, Germany
    Posts
    30
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: invisible control on report

    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:

    <pre>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
    </pre>

    This way, you don't have to worry about preview or print, the report should show the right fields.
    Hope this helps :-)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •