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

ACCESS - Place Image Depending on Field Value

Status
Not open for further replies.

PrgrmsAll

Programmer
Apr 8, 2003
180
US
I am attempting to place an image in a report (Check Printing Application) that is sensitive to data in a particular field. For example, if a field value = "A", I want the image to be "Image A". If a field value = "B", I want the image to be "Image B". And so on.

Thanks in advance!
 
I'm just winging it here, so take it for what it's worth.
Put all three images on your report and pile them on top of one another.
In an event property (I don't know which one: open, activate, format), use the following code:

'if "A" then show pic a and hide pics b and c
If Me![fieldname] = "A" Then Me![graphiccontrolA].visible = true
Me![graphiccontrolB].visible = false
Me![graphiccontrolC].visible = false
Else
'if "B" then show pic b and hide a and c
If Me![Fieldname] = "B" Then Me![graphiccontrolA].visible = false
Me![graphiccontrolB].visible = true
Me![graphiccontrolC].visible = false
'otherwise show pic c and hide a and b
Else Me![graphiccontrolA].visible = false
Me![graphiccontrolB].visible = false
Me![graphiccontrolC].visible = true
End If
End If

I'm still new at this, so there may be problems here. Give it a shot!

Shane
 
A second option--And better.

Create a new table that has two fields: value field and ole object field. Put your values and pictures in the table and in your source data of the report have your original table(s) and your new table in there. create a join between your value in the original table and your value in the new table and include the control for your picture on the report. This will allow for lots of pictures rather than a handful.

Shane
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top