Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2004

    Unanswered: MS Access Report - Hide image based on checkbox

    I have a subreport that contains a bound object frame that I want to hide if a checkbox has not been checked on a form. What code do I use and where to show/hide the image frame based on the value of the checkbox.

  2. #2
    Join Date
    Nov 2003
    Enter the following Function into a code module.
    Function IsLoaded(ByVal strFormName As String) As Boolean
     [color=green' Returns True if the specified form is open in Form view or Datasheet view.[/color]
        Const conObjStateClosed = 0
        Const conDesignView = 0
        If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> conObjStateClosed Then
            If Forms(strFormName).CurrentView <> conDesignView Then
                IsLoaded = True
            End If
        End If
    End Function
    The handy function above simply allows you to see (confirm) if a Access Form is open.

    Now, in the On Format event for the Detail section of your Report, enter code similar to what is shown below:
    If IsLoaded("myMainFormName") Then
       Forms![mySubReportName]![mysubReportImageBoxName].Visible = _
       Not Forms![myMainFormName]![myCheckBoxName].Value 
    End If
    or something like that.....

    Last edited by CyberLynx; 03-21-04 at 02:12.

Posting Permissions

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