The short answer is "Yes, you can, but it won't work as you intend" Here is a trival procedure to colorize a textbox if a condition is met:
Main Topics
Browse All TopicsI have seen posts explaining how the set the CF properties within VBA but these solutions must be triggered explicitly by the user during runtime. I need to have individual rows in a continuous form conditionally formatted with more than three conditions. I tried to use VBA in a function to set the CF properties and call the function from the text box's CF conition through CF dialog. While the code runs without errors the function is never enteed at runtime.
Does anyone know if it is possible to use VBA format rows in a continuous Access form?
Thanks,
Craig Harrington
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
On a continuous form, it makes txtLastName Red for all rows when you are on a qualifying row. On this tyjpe of form, anything that is not determined by binding to a field in the record is the same on all rows. There are some ways of getting around this using Conditional Formatting, but it only permits 3 conditions. Here is a screen shot illustrating the above problem:
MX; I saw your earlier post: 06/29/09 01:21 PM, ID: 24739837 "Let us know if you *can* do more than 3, ok ?
but did not see any replies.
Regarding my intial statement " the function is never enteed at runtime.". I was able call a VBA function within one conditional formatting condition. Initially I simply added "=Func()" to the condition line which did not execute. Later I modified the condition to "iif(Func(), TRUE,FALSE) and was successful in that Func() was indeed called. Ultimately this procedure failed in that once again all records were affected.
Any other thoughts?
Thanks,
Craig Harrington
I placed the following code in Condition 1 of a text box in the detail section of a continuous form
IIf(ConditionFormat()=True
The following is a general function in the form code module.
Private Function ConditionFormat() As Boolean
Dim lngRed As Long
Dim lngBlue As Long
lngRed = RGB(255, 0, 0)
lngBlue = RGB(0, 0, 255)
If Me.ActStatus < 0 Then
Me.rowBackGrndColor.Format
Else
Me.rowBackGrndColor.Format
End If
ConditionFormat = True
End Function
I placed a break in the ConditionFormat function and saw that is is being called from the forms' recordset.UpdateRecSource which I set explicitly in vba.
I thought I had been successful at adjusting the textbox's color in an earlier attempt but now Access crashes after exiting the ConditionFormat function.
Thanks for the help.
Craig Harrington
It would be possible to do a multi-condition function (say, using a Select Case statement), run from the Current event of a CF form, using a match to a combo box or textbox in the form header (as in my sample above), but it would only apply to the current record. IF that is what you need, I will work up some code.
Business Accounts
Answer for Membership
by: DatabaseMXPosted on 2009-08-15 at 11:11:08ID: 25106317
" the function is never enteed at runtime."
Not quite following. Where is the function called from ?
mx