My Assistant
![]()
Custom Search
|
![]() ![]() |
![]() |
![]() Post#1 | |
Posts: 68 Joined: 20-December 12 ![]() | Hi, seems like this should be really easy but I've been struggling too long with it. Maybe someone can tell me what I'm getting wrong? Context -Main form shows Members (i.e., people) -A subreport ("subrptMemberInvoiceList") that's on this form shows all Invoices associated with the selected member. -You choose a member, and it shows you any associated invoices. What I'm trying to do -For each invoice record shown on the subreport, I want to show or hide a small padlock image ("imgPadlock") based on the the value of the field "InvoiceLocked" (boolean). -If InvoiceLocked = TRUE, show the image. -If InvoiceLocked = FALSE, hide the image. Seems simple. What I tried -For testing, I have 4 invoice records for a particular member. Two invoice records have InvoiceLocked = TRUE, and two have InvoiceLocked = FALSE. -I put the following in the subreport's OnCurrent event: CODE Private Sub Report_Current() If (Me.InvoiceLocked = -1) Then Me.imgPadlock.Visible = True Else Me.imgPadlock.Visible = False End If End Sub Result -On load, the padlock image displays for all records (irrespective of the value of InvoiceLocked) -If I click on the record where I know InvoiceLocked is FALSE, all 4 images disappear. -If I click on a record where I know InvoiceLocked is TRUE, all 4 images appear. Is there a more appropriate event I should be using that would allow the image to display for some records but not others? |
![]() Post#2 | |
Posts: 998 Joined: 25-January 16 ![]() | That's because programmatically setting properties of a control affects all instances of control on a form. This is the case for any control, not just Image. Programmatic conditional display per record can be done on report. This post has been edited by June7: Nov 3 2019, 07:32 PM -------------------- Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx |
![]() Post#3 | |
![]() UtterAccess VIP Posts: 10,144 Joined: 25-October 10 From: Gulf South USA ![]() | Hi: This can also be done using a padlock font symbol from, say, Segoe UI Symbol font, and an IIf statement. See the demo attached. This shows this approach in a form, but it can also be done in a report as well. Just another idea ... HTH Joe Attached File(s) -------------------- "Each problem that I solved became a rule, which served afterwards to solve other problems." "You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing." Rene Descartes 1596-1650 (Mathematician and Philosopher) |
![]() Post#4 | |
Posts: 68 Joined: 20-December 12 ![]() | Joe, I love that solution!! Thank you ![]() |
![]() Post#5 | |
![]() UtterAccess VIP Posts: 10,144 Joined: 25-October 10 From: Gulf South USA ![]() | You are very welcome. We are all happy to assist. Continued success ... Regards, Joe -------------------- "Each problem that I solved became a rule, which served afterwards to solve other problems." "You just keep pushing. You just keep pushing. I made every mistake that could be made. But I just kept pushing." Rene Descartes 1596-1650 (Mathematician and Philosopher) |
![]() Post#6 | |
Posts: 998 Joined: 25-January 16 ![]() | I just realized you said you have a subreport on a form. Is that correct? Adjustment to my earlier comment: report has to be to Print or PrintPreview for programmatic conditional display of controls. Glad you found a solution. -------------------- Attachments Manager is below the edit post window. To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression. DEBUG! DEBUG! DEBUG! http://www.cpearson.com/Excel/DebuggingVBA.aspx |
![]() Post#7 | |
Posts: 68 Joined: 20-December 12 ![]() | June7, that's really good to know! Thanks! |
![]()
Custom Search
|
![]() | Search Top Lo-Fi | 6th December 2019 - 03:11 PM |