Logic
Make it easier to see the current record on your Microsoft Access forms! Highlight the current record with a yellow background color (or whatever formatting),
Use a control to keep track of the primary key value (CurrentID), a control to change color (txtHighlight), Conditional Formatting and a little VBA.
While designing, increase the height of the detail section so it's easy to move things around. Create a textbox control called txtHighlight below (for now) and behind everything else. Set properties. Create a textbox control that VBA will change the value of for tracking current value.
Once the controls for showing highlight and tracking PK are created, write VBA code for Current event (at least) and set Conditional Formatting for the unbound txtHighlight.
After testing, in Form Design, move Top of txtHighlight to 0 (zero), close the height of the detail section, and then set the Height of txtHighlight to whatever the section turns out to be.
Your primary key will be the name of your primary key control and someting such as ProductID, OrderID, ContactID, etc. The expression in a Conditional Formatting rule may refer to a control or field name.
If you are using a datasheet form instead of a continuous form, you can't have a control under all the others, so set the conditional formatting rule on every control. You can then select all the controls (remember what you picked! so you can edit as a group next time too) and set the rule(s).
To specify code for an event
- select the object you want such as the form or a control
- go to the Event tab of the property sheet
- choose [Event Procedure] or pick it from the list -- or just type "[" to pick [Event Procedure]
- Click the builder button [...], or press Ctrl+F2, to go to the Visual Basic Editor
- Access will automatically create the Sub declaration and End Sub Statements.
- Type what you want to happen between the procedure declaration and End statements.