You are here:

Using MS Access/Continuous Form formatting


Hi Scott,

I have a subform which I am trying to format, inasmuch as a particular field on the subform.

The field is "LEVEL", and it can come in many varieties for the data - "A", "B", and so on.

I tried this on the Event Load:

Private Sub Form_Load()

   If Me.LEVEL = "A" Then
       Me.LEVEL.BackColor = vbRed
       Me.LEVEL.ForeColor = vbWhite
   ElseIf Me.LEVEL = "B" Then
       Me.LEVEL.BackColor = vbYellow
       Me.LEVEL.ForeColor = vbBlack
       Me.LEVEL.BackColor = vbWhite
       Me.LEVEL.ForeColor = vbBlack
   End If

End Sub

However, every entry turns out with a red background and white forecolor!   Can you help with where I am going wrong?   Am I putting the code in the wrong place, for example?

thanks in anticipation

You have to understand how a continuous form works. In Design mode, all you see is a single set of controls, correct? Well that's the key to understanding this. All you have is a single set of controls that display multiple times. So when you apply formatting to a control, you are applying it to all instances of that control.

Bottom line is formatting single records in a continuous form just doesn't work. You can use the On Current event to format the current record, but it will still format everything.

If you need a visual to highlight certain values, use a report in Report View with Conditional formatting.

Hope this helps,
Microsoft Access MVP 2007
Author: Microsoft Office Access 2007 VBA

Using MS Access

All Answers

Answers by Expert:

Ask Experts




I can answer almost all types of questions relating to Microsoft Access usage and application design. My strengths are database and interface design.


I've been designing databases for over 25 years working with dBase, FoxPro, Approach and Access.

Author of Microsoft Office Access 2007 VBA
Techncial Editor for Special Edition Using Microsoft Access 2007 and Access 2007 Forms, Reports & Queries From Que Publishing

Brooklyn College BA

©2016 All rights reserved.