How to highlight a record in a continuous form?

Below are the steps to highlight a record in a continuous form without writing a class.

1. Make a continuous form and fill it with transparent background controls.  Make sure that the source of the table has a unique identifier, like an Id or some sort.

2. Add two hidden controls, one is the Id mentioned in no. 1 and the other is an unbound control, you can call it “SelectedId”.

3. Add a special control, you call it “BackgroundControl”, position it at the back of the controls you want to highlight.

4. Disable and Lock the three controls mentioned in no. 2 and 3.

5. In the form current event add a simple code as shown below:

Private Sub Form_Current()
    Me.SelectedId = Me.Id
End Sub

6. Now set the background character “█” to the background control mentioned in no. 3 by modifying it’s control source with the following

IIf([id]=[selectedid],"█████████████████████████████████████████","")

Below is the screen shot in design view and form view of my running Item Search form for a POS system.

b2

b1

You can add  Key Codes so that you can use your keyboard to navigate through the record in highlighted fashion.

Thats it.  Have fun coding.

Advertisements

2 thoughts on “How to highlight a record in a continuous form?

  1. Nice share Glenn. Can you share your 2 cents here why still you continue to develop in Access? (I know you’re already an advanced user of LS)

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s