[AccessD] Checking control property in an external mde database

A.D.TEJPAL adtp at airtelbroadband.in
Mon Nov 27 23:49:56 CST 2006


Rocky,

    For accessing control's properties, the form has to be open either in design or run time view. In case of mde, design view is ruled out.

    Function Fn_IsControlVisibleInExternalDb() as given below, will get you the visible status of desired control in external db. Though it involves opening & closing of target form in external db, the process remains invisible to the user.

    Note - If the target form is in datasheet view, mere checking of visible property does not conclusively establish whether the column in question is displayed or not. For that, ColumnHidden property has to be verified. Interestingly, ColumnHidden property is detectable only at run time (not in design view).

Best wishes,
A.D.Tejpal
----------------

=====================================
Function Fn_IsControlVisibleInExternalDb( _
                ByVal FilePath As String, _
                ByVal FormName As String, _
                ByVal ControlName As String) As Boolean
    ' Returns True if the control is visible.
    ' Otherwise False
    On Error GoTo ErrTrap
    Dim acp As Access.Application
    
    Fn_IsControlVisibleInExternalDb = False     ' Default
    
    Set acp = New Access.Application
    acp.OpenCurrentDatabase FilePath
    
    acp.DoCmd.OpenForm FormName
    
    If acp.Forms(FormName)(ControlName).Visible _
                                                            = True Then
        Fn_IsControlVisibleInExternalDb = True
    End If
    acp.DoCmd.Close acForm, FormName
    
ExitPoint:
    On Error Resume Next
    acp.Quit
    Set acp = Nothing
    On Error GoTo 0
    Exit Function

ErrTrap:
    MsgBox "Err " & Err.Number & " - " & Err.Description
    Resume ExitPoint
End Function
=====================================

  ----- Original Message ----- 
  From: Beach Access Software 
  To: 'Access Developers discussion and problem solving' 
  Sent: Saturday, November 25, 2006 19:38
  Subject: [AccessD] Checking control property in an external mde database


  Dear List: 

  Is it possible to check the visible property of a control on a form in
  another database which is an mde?  Would it be necessary to have that database is currently open with that form opened? 

  MTIA 

  Rocky


More information about the AccessD mailing list