Formatting continuous form field in current record only

D

dee

I need to change formatting on a single field in the current record.
My code works, but it formats every record.
My form is a continuous form called "FmMailed".

My code below:

Private Sub First_Name_DblClick(Cancel As Integer)

If Me.Flag1 = 1 Then
Me.Flag1 = Null
Me.First_Name.FontBold = False
Me.First_Name.BackColor = vbWhite
Me.First_Name.ForeColor = vbBlack
Me.Requery
Else
Me.Flag1 = 1
Me.First_Name.FontBold = True
Me.First_Name.BackColor = vbBlue
Me.First_Name.ForeColor = vbWhite
Me.Requery
End If

End Sub

I am not a programmer and would very much appreciate a correction to
my code.
 
J

John W. Vinson

I need to change formatting on a single field in the current record.
My code works, but it formats every record.
My form is a continuous form called "FmMailed".

My code below:

Private Sub First_Name_DblClick(Cancel As Integer)

If Me.Flag1 = 1 Then
Me.Flag1 = Null
Me.First_Name.FontBold = False
Me.First_Name.BackColor = vbWhite
Me.First_Name.ForeColor = vbBlack
Me.Requery
Else
Me.Flag1 = 1
Me.First_Name.FontBold = True
Me.First_Name.BackColor = vbBlue
Me.First_Name.ForeColor = vbWhite
Me.Requery
End If

End Sub

I am not a programmer and would very much appreciate a correction to
my code.

A continuous form appears to have multiple controls, but in reality it only
has one First_Name control, displayed many times; so changing its properties
will change all instances of it.

The solution is to open the form in design view and use Conditional
Formatting. In A2003 and earlier, use the Format menu option in form design
and choose "Conditional Formatting" from the menu; in 2007/2010 use the
"Conditional" box toward the left of the Form Design Tools ribbon.
--

John W. Vinson [MVP]
Microsoft's replacements for these newsgroups:
http://social.msdn.microsoft.com/Forums/en-US/accessdev/
http://social.answers.microsoft.com/Forums/en-US/addbuz/
and see also http://www.utteraccess.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top