Access.2007.VBA.Bibl..

(John Hannent) #1

Determine whether original the control names should be stored in the Tag property.


pstrMessage = _
“When processing form controls, should the original “ _
& “control name be saved to the control’s Tag “ _
& “property?”
intTag = MsgBox(pstrMessage, vbYesNo + vbQuestion + _
vbDefaultButton2, “Control Name Backup”)

If intTag = vbYes Then
blnTag = True
Else
blnTag = False
End If

Process the open forms.


For Each pfrm In pappAccess.Forms

For Each pctl In pfrm.Controls
strCtlName = pctl.Name
plngControlType = pctl.ControlType
blnUnbound = False

Select Case plngControlType

Controls with control source


Case acTextBox
strPrefix = “txt”
i = ControlCS(pctl, strPrefix, blnTag)

Case acComboBox
strPrefix = “cbo”
i = ControlCS(pctl, strPrefix, blnTag)

Case acCheckBox
strPrefix = “chk”
strControlSource = pctl.ControlSource
If blnUnbound = False Then
i = ControlCS(pctl, strPrefix, blnTag)
Else
i = ControlNA(pctl, strPrefix, blnTag)
End If

Case acBoundObjectFrame
strPrefix = “frb”
i = ControlCS(pctl, strPrefix, blnTag)

Creating COM Add-ins with Visual Basic 6 13

Free download pdf