Solved

Change picture based on the recordsource

Posted on 2011-02-27
4
211 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 14

Expert Comment

by:Bill Ross
ID: 34991764
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
ID: 34991780
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
ID: 34991878
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
ID: 34992034
Glad to be of help.

Bill
0

Featured Post

The Eight Noble Truths of Backup and Recovery

How can IT departments tackle the challenges of a Big Data world? This white paper provides a roadmap to success and helps companies ensure that all their data is safe and secure, no matter if it resides on-premise with physical or virtual machines or in the cloud.

Question has a verified solution.

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

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

734 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