CenterCaptionInAdodc - Center a caption on an ADODC Data control
' Center caption in Adodc control
'
' Input: frmForm - Form Adodc contol in on
' datAdodc - Adodc control
' sCaption - Caption text
'
' Output: Padded Caption text
Sub CenterCaptionInAdodc(ctrl As Adodc, ByVal sCaption As String)
Dim lTextWidth As Long
Dim lSpaceWidth As Long
Dim iPad As Long
sCaption = Trim(sCaption)
lTextWidth = ctrl.Parent.TextWidth(sCaption)
lSpaceWidth = ctrl.Parent.TextWidth(" ")
iPad = Round(((ctrl.Width - lTextWidth - 1300) / 2) / lSpaceWidth, 0)
ctrl.Caption = Space(iPad) + sCaption
End Sub