Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 18th, 2007, 05:47 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Bolding some record of report [Solved]

Hello,
I cannot find the correct code for turning a record line into bold based on a criteria.
Here is the code I use for changing the BackColour but there does not seem to be a specific property for changing the field's bold property.

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me.F_MANAGER = True Then
    Me.Detail.BackColor = RGB(220, 220, 220)
Else
    Me.Detail.BackColor = vbWhite
End If
End Sub

Can you please help ?

Thanks in advance,
Sven
 
Old July 18th, 2007, 06:49 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Here you are changing the Detail back color. You can't change the entire record to bold, you have to do it for each control in the Detail section (as far as I know.)

For example:

If Me.F_MANAGER = True Then
   Me.FirstName.FontBold = True
   Me.LastName.FontBold = True
   ...
Else
   Me.FirstName.FontBold = False
   Me.LastName.FontBold = False
   ...
End If

mmcdonal
 
Old July 18th, 2007, 07:54 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
 Here you are changing the Detail back color. You can't change the entire record to bold, you have to do it for each control in the Detail section (as far as I know.)

For example:

If Me.F_MANAGER = True Then
Me.FirstName.FontBold = True
Me.LastName.FontBold = True
...
Else
Me.FirstName.FontBold = False
Me.LastName.FontBold = False
...
End If

mmcdonal
As simple as that damit!!!
I sometimes wonder why the autosense does not offer the property in the list.
Thanks a lot mmcdonal,
Sven

 
Old July 18th, 2007, 07:58 AM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Actually, if you are typing

Me.Detail.

then you won't get a FontBold autosense, but if, for example, you are typing

Me.FirstName.

then you should get a FontBold autosense.

This is a little tedious, but works. I suppose you could do a For Each ctl etc, but that would end up taking the same amount of time. Plus you can copy and paste the control names once you do the Then section to the Else section.


mmcdonal
 
Old July 18th, 2007, 08:04 AM
Registered User
 
Join Date: Jul 2007
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by mmcdonal
 Actually, if you are typing

Me.Detail.

then you won't get a FontBold autosense, but if, for example, you are typing

Me.FirstName.

then you should get a FontBold autosense.

This is a little tedious, but works. I suppose you could do a For Each ctl etc, but that would end up taking the same amount of time. Plus you can copy and paste the control names once you do the Then section to the Else section.


mmcdonal
No, not event if type Me.FirstName. I do not get the property in the list... strange.
Anyway, I just have 5 fields to turn to bold so it is not a problem to do them one by one.






Similar Threads
Thread Thread Starter Forum Replies Last Post
SOLVED - VBA Help For Row Source and Record Source eusanpe Access VBA 4 May 13th, 2008 11:58 AM
Colouring first record of report [Solved] Svenzardda Access VBA 1 July 18th, 2007 06:44 AM
Syntax Error -- BUG REPORT Solved dparsons MySQL 1 October 5th, 2006 01:38 PM
Dynamic bolding causes surrounding text to move. CFGerry BOOK: Beginning CSS: Cascading Style Sheets for Web Design ISBN: 978-0-7645-7642-3 1 October 7th, 2005 06:50 AM
Bolding threads bmains Forum and Wrox.com Feedback 0 February 3rd, 2005 12:35 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.