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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replacing string in Access report with a checkmark 1

Status
Not open for further replies.

doug61391

Technical User
Oct 18, 2010
2
US
Hello,

I'm a safety professional and I have to write my own software. I end up doing a lot of trial and error but I'm stuck on this one.
I have a report based on a query in Access 2002. It reports on the result of an inspection of 15 different areas of a school. The report contains 15 combo boxes in the detail section. The values of each of those boxes can be "OK", "D", "X", or "NA". I want the report to show the the D,X, or NA values but if the value is OK, I want the report to show a checkmark.
I'm thinking I need to place a for each/next loop in the OnFormat event of the detail area to evaluate the value of each control. If it equals "OK", I need to change the font to wingdings and print Char<0252>.

Here's some code that doesn't work:

Dim ctl As Control

Set ctl = [1 gas leaks]
For Each ctl In Controls
If ctl = "OK" Then

ctl.FontName = "wingdings"
ctl.Text = "ü"

End If
Next ctl

End Sub

Is this the right tack to take on this problem? Can anyone suggest code for this to get me started?
 
I would be a little lazier....

Use the IIF function and two transparent controls.

Control Source of your textbox...

Code:
= IIF([i]<Field>[/i] = "OK", "", [i]<Field>[/i])


Then you need a textbox with a similar formula...

Code:
= IIF([i]<Field>[/i] = "OK", -1, 0)

I am relatively sure that is good enough for the text box.

Without playing I do not remember if you can get the checkbox border to go away....

You may however need to set the visible property to true / false for the checkbox on the report's format event.
 
Yessir, that's working for me!

I left the combo box in the detail section and set it to not visible. Then I created 2 textboxes and stacked them on top of the combo box using the iif statements. For the checkmark, I used the alt-0252 and set that box's font to Wingdings (it's what the Excel spreadsheet I'm trying to match uses).

Is there a really good way to say thank you?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top