Trying to use the old way of hiding the arrow of combo boxes.
I pass the name of the textboxes to cover the combo boxes in form's open event:
Then I try to control the text box by :
Opening the form, still the arrow is visible.
If I remove the following line and manually set the backStyle in property sheet of textbox to normal, it works.
.Controls(Ctrl).BackStyle = acNormal
My question:
Why setting the backstyle in vba causes the process to fail and should be set manually?
Thanks.
PS:
Sample file attached.
I pass the name of the textboxes to cover the combo boxes in form's open event:
SQL:
Private Sub Form_Open(Cancel As Integer)
Dim Ctrls As String
Ctrls = "txtOrderID"
HideComboArrows Me, Ctrls
End Sub
Then I try to control the text box by :
SQL:
Public Sub HideComboArrows(frm As Access.Form, Ctrls As String)
Dim Ctrl As Variant
Dim Expression As String
Dim cmb As String
With frm
For Each Ctrl In Split(Ctrls, ",")
cmb = Mid(Ctrl, 4)
Expression = "=ShowCombo ('" & frm.Name & "', '" & cmb & "')"
.Controls(Ctrl).Left = .Controls(cmb).Left
.Controls(Ctrl).Width = .Controls(cmb).Width
.Controls(Ctrl).Top = .Controls(cmb).Top
.Controls(Ctrl).Height = .Controls(cmb).Height
.Controls(Ctrl).OnEnter = Expression
.Controls(Ctrl).BackColor = .Controls(cmb).BackColor
.Controls(Ctrl).ControlSource = "=[" & cmb & "].[Column](1)"
.Controls(Ctrl).LeftMargin = .Controls(cmb).LeftMargin
.Controls(Ctrl).Locked = True
.Controls(Ctrl).BackStyle = acNormal
.Controls(cmb).TabStop = False
'' .Controls(Ctrl).ZOrder (0)
Next
End With
End Sub
Opening the form, still the arrow is visible.
If I remove the following line and manually set the backStyle in property sheet of textbox to normal, it works.
.Controls(Ctrl).BackStyle = acNormal
My question:
Why setting the backstyle in vba causes the process to fail and should be set manually?
Thanks.
PS:
Sample file attached.
Attachments
Last edited: