Ryan Buddicom
Ryan Buddicom

Reputation: 1151

How can I replace a value on an Access 2007 report with an image?

I have a colour field in the table I am reporting from. I am intending to replace this text on a report with a small square of colour based on the word.

I have been digging around in Access for days trying to do this and cant seem to find any options in VBA nor the Properties pane.

Updates: Thanks to Tom for pointing me in the right direction, so far I have this sort of working, decided to use a textbox instead of a rectangle as then I can still have the colour text inside. So using the Report_Current event I wrote a huge "Select Case Report_rptSRSearch.Colour" to handle this.

Using the Report_Current event does not seem to give the exact required functionality however. It will do exactly what I want except only when the user physically clicks the record on the report.

Upvotes: 0

Views: 387

Answers (2)

Ryan Buddicom
Ryan Buddicom

Reputation: 1151

So finally figured this out and you have to use the Detail_Paint method. Duh ;)

Upvotes: 0

Tom Collins
Tom Collins

Reputation: 4069

Not testing this, so my syntax may be off slightly.

Create your square on your form. In this example we'll call it square1. On the Form_Current event (VBA), check the value of the colour field, and using a Select Case statement, set the background colour of square1.

Upvotes: 2

Related Questions