Results 1 to 2 of 2
  1. #1
    Whizbang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    37

    Conditionally Show/Hide Button In Report View in Access 2010

    Evidently Access 2010 does not fire the OnPrint or OnFormat events for Report View. I have a report that is semi-interactive in that some records should display a "Process" or "Deny" button. I need it to be in Report View so that the buttons are clickable.

    I want to run this code in the report's OnFormat event:
    Code:
    Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
        If Nz(Me.Status, "") = "" Then
            Me.cmdProcess.Visible = True
            Me.cmdDeny.Visible = True
        Else
            Me.cmdProcess.Visible = False
            Me.cmdDeny.Visible = False
        End If
    End Sub
    Looking around, the only event that fires for Report View that might be useful is the OnPaint event. But Access does not allow changing the .Visible property through the OnPaint event. I've done some searching, but cannot find a solution. If no solution is found, I'll have to have the buttons always visible and then just check conditions OnClick, but that is a last resort.



    Any advice or help would be appreciated.

  2. #2
    Whizbang is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Posts
    37
    I have settled on a solution that uses NZ([Status],"Process") as the control source. If the control says "Process", I then use conditional formatting to make the text look like a hyperlink. I use the MouseMove event to change the cursor into a finger like you would for a link, and use the Click event to do what I want.

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

Similar Threads

  1. Expand Button in Datasheet View Doesn't show related table
    By CementCarver in forum Database Design
    Replies: 5
    Last Post: 07-17-2013, 11:48 AM
  2. Hide button on printed report
    By tylerg11 in forum Reports
    Replies: 5
    Last Post: 12-03-2012, 03:20 PM
  3. Replies: 3
    Last Post: 11-18-2012, 12:49 PM
  4. Replies: 3
    Last Post: 02-17-2011, 10:19 AM
  5. Conditionally hide detail row in report
    By martinjamesward in forum Reports
    Replies: 5
    Last Post: 09-06-2010, 02:51 AM

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