Lebans Code

D

DS

Hi I've set up Conditional formating on a continous form based on a
Checkbox, if it =0 then the lettering is black, if it's true then the
letterin is red. This works fine. The problem is that the field is
disabled but becomes enabled. Lebans code is suppose to prevent this but
I can't seem t figure out how to use it.

Private Sub Form_Load()
Dim objFrc As FormatCondition

THIS PART I UNDERSTAND
' Remove any existing format conditions.
Me.txtBackGround.FormatConditions.Delete

' Create a format object and add it to the FormatConditions collection.
' We have to pass to pass a value to the function otherwise
' Access will only execute the function once.
' Also due to a bug we must programmatically setup the
' Conditional Formatting here. Otherwise if you were to setup
' CF via the GUI the state of the Disabled property
' is not respected. This will allow our Background TextBox control
' to receive the focus and be activated - something we don't want!!

THIS PART LOOSES ME
Set objFrc = Me.txtBackGround.FormatConditions.Add(acExpression, _
, "Hover([txtFormat],[RowNumber])")
THE PART .Add(ac......................RowNumber])")
IS THIS WHERE I PUT MY CODE.......?

' Setup our props
With Me.txtBackGround.FormatConditions(0)
..BackColor = vbRed
..Enabled = False
End With
Set objFrc = Nothing
End Sub

THANKS
Any help appreciated.
DS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top