Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Change picture based on the recordsource

Posted on 2011-02-27
4
Medium Priority
?
215 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
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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

927 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