muppetgeoff
New member
- Local time
- Today, 03:20
- Joined
- Aug 9, 2004
- Messages
- 9
Hi,
After a *lot* of searching, and looking at various code samples, I finally figured out a *very* easy way to get alternate Row colours (colors) in continuous forms.
I can't post a sample just yet, but the instructions are:
1) Create the Public function:
2) Create a hidden unbound text box in the form, name it "txtRowState" , and set its control source to "=fcnRowState()"
3) Set its Back color to the first of the 2 colors you want to alternate between, and make sure you set the Text color to the same (so the text doesn't show up)
4) Set it's 'Locked' property to 'Yes', and its 'Enabled' property to 'No'.
5) Set a Conditional format for it. Set the 'Condition1' to [Field Value Is - Equal To - "0"], again set the background and text colors to the same (so the text doesn't show up)
6) If required, Create a label with just a space, and expand it to cover the unbound text box. This will just sheild users from interacting with the conditional formatting
That's it, Job done!
This method relies on a quirk with the Boolean Data type, where adding 1 to a 0, results in -1 ! and of course adding 1 to -1 gives a 0
I spent a few hours tonight scouring the Net for solutions, and they all seemed clunky or limited.
This solution was inspired by CodeWidgets.com
Now you can sort your forms any way you like, and the row colors will always alternate
Kind regards,
Geoff
After a *lot* of searching, and looking at various code samples, I finally figured out a *very* easy way to get alternate Row colours (colors) in continuous forms.
I can't post a sample just yet, but the instructions are:
1) Create the Public function:
Code:
'(Create the Variable first)
Public varRowState As Boolean '(This may need to go at the top of the Code module)
'(Now the toggle function)
Public Function fcnRowState() As Boolean
varRowState = varRowState + 1
fcnRowState = varRowState
End Function
2) Create a hidden unbound text box in the form, name it "txtRowState" , and set its control source to "=fcnRowState()"
3) Set its Back color to the first of the 2 colors you want to alternate between, and make sure you set the Text color to the same (so the text doesn't show up)
4) Set it's 'Locked' property to 'Yes', and its 'Enabled' property to 'No'.
5) Set a Conditional format for it. Set the 'Condition1' to [Field Value Is - Equal To - "0"], again set the background and text colors to the same (so the text doesn't show up)
6) If required, Create a label with just a space, and expand it to cover the unbound text box. This will just sheild users from interacting with the conditional formatting
That's it, Job done!
This method relies on a quirk with the Boolean Data type, where adding 1 to a 0, results in -1 ! and of course adding 1 to -1 gives a 0
I spent a few hours tonight scouring the Net for solutions, and they all seemed clunky or limited.
This solution was inspired by CodeWidgets.com
Now you can sort your forms any way you like, and the row colors will always alternate
Kind regards,
Geoff
Last edited: