Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Formating problem

Posted on 2012-09-05
9
Medium Priority
?
329 Views
Last Modified: 2012-09-06
I have the following expression in a query...

 IIf(IsNull([Details Extended]![DESCRIPTION]),[QryPL_Line]![DESC_ONLY],[Details Extended]![DESCRIPTION])

I want to have the  [QryPL_Line]![DESC_ONLY] centered and bolded if it shows on the report.  Anyone know how to do that?
0
Comment
Question by:lrollins
  • 4
  • 4
9 Comments
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 500 total points
ID: 38369313
Make sure that DESC_ONLY is included as a field in the SELECT clause in your query and try the following VBA in your report's Detail Format event:


If Me.txtDescription = Me.[DESC_ONLY]
        Me.txtDescription.TextAlign = "Center"
        Me.txtDescription.FontBold = True
Else
        Me.txtDescription.TextAlign = "Left"
        Me.txtDescription.FontBold = False
End if

Open in new window


Adjust the code for text alignment as needed, and replace "txtDescription" in all places with the actual name of the textbox holding the description.
0
 
LVL 1

Author Comment

by:lrollins
ID: 38369356
I don't think that will work.  I need it to be within the expression that I've written because I only need the desc_only field to be centered and bold but I will try it.
0
 
LVL 1

Author Comment

by:lrollins
ID: 38369409
That doesn't work...
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 61

Expert Comment

by:mbizup
ID: 38369481
You can't format text on a report through an experssion in a query (there is no way to do that).

My understanding of what you are trying to achieve however is this:

- You have a textbox on your report
- It will display either DESC_ONLY or DESCRIPTION depending on whether or not DESCRIPTION is null
- You want the text in that textbox to be centered and bold if its value is DESC_ONLY (but not if it's value is DESCRIPTION)


Is that understanding correct?

What is the name of the textbox on your report?
0
 
LVL 46

Accepted Solution

by:
aikimark earned 500 total points
ID: 38370560
Assuming that the [DESCRIPTION] column is a column in the recordsource for the report, the following statement in the Report_Format() event should work.
If IsNull(me![DESCRIPTION])
        Me.txtDescription.TextAlign = "Center"
        Me.txtDescription.FontBold = True
Else
        Me.txtDescription.TextAlign = "Left"
        Me.txtDescription.FontBold = False
End if

Open in new window


Note: this code is based on mbizup's http:#a38369313 comment code
0
 
LVL 1

Author Comment

by:lrollins
ID: 38371879
MBIZUP....  That is exactly what I am doing and trying to do....
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38371902
Okay -

Assuming that the control names, field names, etc are correct either the code that I posted or aikimark's modification to it should work.

If the Detail Format event doesn't work, try the Detail Print event.

Can you post a sample database (with any sensitive data removed, and preferably in .mdb format), so that we can take a look at it?
0
 
LVL 61

Expert Comment

by:mbizup
ID: 38371920
Also if you are using Access 2007 or 2010, not all report events run in Report View.  If you were opening your report in Report View, try using Print Preview instead.
0
 
LVL 1

Author Closing Comment

by:lrollins
ID: 38372258
That worked fine.  I had to open in print preview as you suggested.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Explore the ways to Unlock VBA Project Password Excel 2010 & 2013 documents. Go through the article and perform the steps carefully to remove VBA Excel .xls file.
Windows Explorer lets you open cabinet (cab) files like any other folder. In VBA you can easily handle normal files and folders, but opening and indeed creating cabinet files takes a lot more - and that's you'll find here.
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

564 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question