By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,311 Members | 1,839 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,311 IT Pros & Developers. It's quick & easy.

Continuous Forms Problem

100+
P: 283
Hello,

I having some problems with a form where I have it set to Continuous Forms. I have a text box that I want to turn Red when a condition is met but when the condition is true it turns all of the text boxes red and not just the one on the current form I have focus on.

Is there any way to do with this VBA? I have created the condition in VBA just cant figure out the form part.

Appreciate any help!

Thanks
Slen

Working in Access 2007

Here is the code for the conditional expression
Expand|Select|Wrap|Line Numbers
  1. Dim objFrc As FormatCondition
  2.  
  3.  
  4. Me![txtBox].FormatConditions.Delete
  5.  
  6. Set objFrc = Me.Record_Number.FormatConditions.Add(acExpression, acEqual, Me.CheckBox.Value = True)
  7.  
  8. Select Case CheckBox.Value
  9. Case True
  10. With Me![txtBox].FormatConditions(0)
  11.                 .BackColor = vbRed
  12.             End With
  13.  
  14. End Select
  15.  
Dec 1 '11 #1

✓ answered by NeoPa

Please see Why Values in Unbound Form Controls do not Persist. If your control is bound, you may find Conditional Formatting worth checking out though.

Share this Question
Share on Google+
5 Replies


NeoPa
Expert Mod 15k+
P: 31,707
Please see Why Values in Unbound Form Controls do not Persist. If your control is bound, you may find Conditional Formatting worth checking out though.
Dec 1 '11 #2

100+
P: 283
Hi NeoPa,

Been a while..how have you been?

The form im currently using is a bound form unlike my usual MO of unbound. Im using continuous forms so I found using a bound form to be better suited for this.

Is there any way to use Conditional Formating with the bound form and keep the focus on the current form? If I set the condition of a text box by using the user friendly way and just clicking on the conditions button and then set the condition. But im trying to do it with VBA. Any ideas?

Thanks :D
Dec 1 '11 #3

NeoPa
Expert Mod 15k+
P: 31,707
Hi Slenish. I'm good thanks. You too I hope.

The fundamental point is that there is only the one control, no matter how many instances of this you see on the form. I think that means that any VBA code would be pointless. You can only configure the control one way. What would be the point of changing it while it's running. Any definition could more easily be done at design time.
Dec 1 '11 #4

100+
P: 283
Hi NeoPa. Im doing good as well.

Guess if i cant do it with VBA thats alright I can always do it the other way with the conditions button. Just thought I would challenge myself :D

Appreciate the help my friend.
Dec 1 '11 #5

NeoPa
Expert Mod 15k+
P: 31,707
Always welcome :-)

NB. It's not exactly that VBA cannot set the control up to do the conditional formatting, it's more that there would be no point when you can include it in the design (as there is no point during the running of the code where it would be appropriate to change the configuration).
Dec 1 '11 #6

Post your reply

Sign in to post your reply or Sign up for a free account.