Solved

Change picture based on the recordsource

Posted on 2011-02-27
4
204 Views
Last Modified: 2012-06-21
I am trying to change the image shown on a continuous form based on the return value of the records field.

Using a subfrom that has a continuous form type
An image control (imgAsset)

RecordSource= "SELECT imgType From...."

imgType currently:   1 = img1, 2 = img2
(I can switch this in the sql to bring back the picture name if needed)

so basically on each row for the imgAsset I want this:

with imgAsset
select case imgType
 case 1: .picture = "img1"
 case 2: .picture = "img2"
end with

do I do this in the control source...what is the best way.

tnx experts


0
Comment
Question by:skillilea
  • 3
4 Comments
 
LVL 14

Expert Comment

by:Bill Ross
Comment Utility
Hi skillilea,

As you've probably found by now, in a continuous form imgAsset will always have the same picture unless it is a bound object.  You cannot assigne a separate picture to each row unless it's bound to the picture in the recordsource.  That's because an unbound object is just a single object repeated for each row in a continuous form.

Regards,

Bill
0
 
LVL 14

Accepted Solution

by:
Bill Ross earned 500 total points
Comment Utility
Hi,

To make this work correctly you need to use a bound object frame that is bound to the image that is stored in the recordsource.  You're on thre right track by having the SQL return the picture.  Bind this field to the imgAsset and it should work.

Bill
0
 

Author Comment

by:skillilea
Comment Utility
I ended up with this in the controlsource of the imgControl.

=Switch([AssetType]=1,"p_tool",[AssetType]=2,"p_part",[AssetType]=3,"p_book",[AssetType]=4,"p_innogear",[AssetType]=5,"p_who")


good until I have img changes and additions I think.

Other way would be to store the image file but...I'm not excited about that.

Thanks tons for the help.

sk
0
 
LVL 14

Expert Comment

by:Bill Ross
Comment Utility
Glad to be of help.

Bill
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
I originally created this report in Crystal Reports 2008 where there is an option to underlay sections. I initially came across the problem in Access Reports where I was unable to run my border lines down through the entire page as I was using the P…
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

772 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now