Condition Formatting

  • Thread starter kft10 via AccessMonster.com
  • Start date
K

kft10 via AccessMonster.com

Hi everyone,

I'd like to create report with condition on field 'Client'. If [Client_field]
= Yes then [Encounters-field] should be printed on Left align else printed on
right align. I tried to figured it out using 'Conditional Formatting' feature
from Access and VBA script, but I couldn't find the way.

Is anyone on the forum have any ideas to find the other ways? Thank you in
advance.

Rgds,
KF
 
J

John Spencer

Conditional formatting cannot do that you will need to use VBA in the
Format event of the relevant section

IF Me.Client_Field = True Then
Me.[Encounters-Field].TextAlign = 1
ELSE
Me.[Encounters-field].TextAlign = 3
END IF

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2009
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 
A

Al Campagna

KF,
Assuming Client_Field is Boolean True/False (Yes/No)

Use the report section where Client_Field and Encounters_Field print.
In that section's OnFormat event...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [Client_Field] = Yes Then
[Encounters_Field].TextAlign = 1 'Left align
Else
[Encounters_Field].TextAlign = 3 'Right align
End If
End Sub

See TextAlign in help...
--
hth
Al Campagna
Microsoft Access MVP
http://home.comcast.net/~cccsolutions/index.html

"Find a job that you love... and you'll never work a day in your life."
 
K

kft10 via AccessMonster.com

It works. Thank you so much guys...

Al said:
KF,
Assuming Client_Field is Boolean True/False (Yes/No)

Use the report section where Client_Field and Encounters_Field print.
In that section's OnFormat event...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If [Client_Field] = Yes Then
[Encounters_Field].TextAlign = 1 'Left align
Else
[Encounters_Field].TextAlign = 3 'Right align
End If
End Sub

See TextAlign in help...
Hi everyone,
[quoted text clipped - 11 lines]
 

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