Highlighting the current record on a continuos form can be tricky since conditional formatting has no built in conventions for recognizing when a record is selected and as Mary stated using the oncurrent event changes the formating of all records not just the current one (if that makes sense).
But, If your absolutley determined to highlight the current record you can do so by using this workaround method.
First, your form’s record source must contain a unique identifier for the records such as a primary key (if it doesn’t it probably should for general principals) this does not need to have a control on the form, as long as its present in the recordsource.
Second, you will need to create a module and declare a global variable as well as a function to pass that variable back to Access. See this discussion
http://www.thescripts.com/forum/thread558852.html
Once you have your module complete your ready to setup your oncurrent event and conditional formatting.
In the forms on current event enter this code
-
-
Private Sub Form_Current()
-
-
CurRec = Me.[myPrimaryID] ‘CurRec is the global variable declared in your module
-
DoCmd.Requery "Text1"
-
-
End Sub
In your requery command you need only requery one control even if the conditional formatting is on several controls, they all update with a single requery, also don’t requery the whole form because that restarts the form’s on current event and the form hangs.
Then in the controls’ conditional formatting enter the expression:
- [myPrimaryID]=Glovar("CurRec")
You can use conditional formatting on all of your controls or create an unbound textbox behind the forms to act as a background and just format that. If you do the latter you’ll want to put a gotocontrol command in the unbound text boxes on enter event so if the user clicks on it they are automatically sent to another control.
Hope this helps,
Megan