Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Italics in Report 2

Status
Not open for further replies.

gregmw

MIS
Jun 11, 2002
23
NZ
How do I use the vb code in a report to change a text box to italic based on what's in the text box I have tried the code below. But it dosen't change the Font to Italics

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me![ToChange] <= -200000 And Me![ccycheck] = "GBP" Then
Me![ToChange].FontItalic = Yes
Else

Me![ToChange].FontItalic = No
End If
End Sub
 
Some properties are only accessible through the properties collection...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me![ToChange] <= -200000 And Me![ccycheck] = "GBP" Then
Me![ToChange].Properties("FontItalic") = Yes
Else

Me![ToChange].Properties("FontItalic") = No
End If
End Sub
 
If you are using Access 2000 or later, you can use Conditional Formatting. Are you sure your control name is "ToChange"? Is ccycheck a text box in the detail section?

Duane
MS Access MVP
Find out how to get great answers faq219-2884.
 
lameid: your answer dosen't seem to work the report runs but none of the formatting changes to Italics. I have used the same code with Me![ToChange].ForeColor = vbRed which changes the correct figures to red.

dhookom: I am using 97. Yes to both of your other questions. The code works for when modifying the colour of ccycheck but not for changing the style.

Also when I use the output to word button in Access the report loses the colour format from the code. Is there anyway to keep the look of the report the same as in Access as Word??

Thanks
 
Okay I have figured it out needed speech marks around the
"Yes" to make it work.

However still don't know how to output to word with out losing the formatting the code has changed. Any ideas? Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top