Solved

Change picture based on the recordsource

Posted on 2011-02-27
4
212 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
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 …
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

636 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