Formatting text on a Report

K

Kedd123

Does anyone see a problem with the following code? It does not do anything
(and there are no error messages). I am trying to turn the text under the
cloumn heading bold. The field name is LoginLot. There is no conditional
formatting and the report is based on a query.

Private Sub CommandPrintLogin_Click()
On Error GoTo Err_CommandPrintLogin_Click

Dim stDocName As String

stDocName = "QueryLoginrEPORT"
DoCmd.OpenReport stDocName, acViewPreview

Reports!queryloginreport!LoginLot.FontBold = True

Exit_CommandPrintLogin_Click:
Exit Sub

Err_CommandPrintLogin_Click:
MsgBox Err.Description
Resume Exit_CommandPrintLogin_Click

End Sub
 
P

Paolo

Hi Kedd123,

Add this statement in the on open event of your report
LoginLot.FontBold = True

and remove this from the code you posted
Reports!queryloginreport!LoginLot.FontBold = True

HTH Paolo
 
A

Allen Browne

There's a timing problem.

The report is already formatted (at least partly) before the code runs.

Just open the report in design view and save it with the text box set to
bold.

Alternatively use the report's Open event to set the property of the
control.
 
K

Kedd123

Thank you for your help!

Allen Browne said:
There's a timing problem.

The report is already formatted (at least partly) before the code runs.

Just open the report in design view and save it with the text box set to
bold.

Alternatively use the report's Open event to set the property of the
control.
 

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