Compléments pour Microsoft Access

http://access.fr.free.fr/

Vérifier l'existence d'un contrôle sur le form actif (Formulaire)

Description 

Cette fonction permet de tester si un contrôle existe dans le formulaire actif à l'écran dans la base de données en cours.

 
Synthaxe 

ControlExistForm(strControl)

La synthaxe de la fonction ControlExistForm comprend l'élément suivant :

ElémentsDescription

strControl

Expression de chaîne correspondant au nom du contrôle de formulaire que l'on souhaite vérifier.
 
Exemple 

Aucun exemple disponible pour le moment.

 
Code de la fonction 

Function ControlExistForm(strControl As String) As Boolean

'Vérifie l'existant d'un control sur le formulaire actif
On Error GoTo ErrControlExist
Dim frm As Form
Dim ctl As Control
Set frm = Screen.ActiveForm
For Each ctl In frm.Controls
    If ctl.Name = strControl Then
        ControlExistForm = True
        Exit For
    End If
Next
Exit Function
ErrControlExist:
    MsgBox Err.Number & vbCrLf & vbCrLf & Err.Description, vbCritical

End Function