IF... then a picture

Pinkoto

Registered User.
Local time
Today, 12:16
Joined
Jun 25, 2014
Messages
73
hello,
how can i make a image appear in my form when there is a check in the check box from the table?
 
How is this image brought into the form? Attachment or linking?
 
Can you add a condition to a Image control?
 
im making a list for movies, the check box is if the movie has won an Oscar for best film.So if i have checked it i want a picture of a little Oscar to appear in the form. If the check box isnt checked then there is no need of a picture.
 
im making a list for movies, the check box is if the movie has won an Oscar for best film.So if i have checked it i want a picture of a little Oscar to appear in the form. If the check box isnt checked then there is no need of a picture.
Okay that does not answer my question ! Where is this picture going to come from?
 
i guess the best way is to put an image in the form. Then if i have checked the box the image should be visible and if its not checked then it shouldn't be visible. the checkbox field is named bestpictureoscer and my file is named oscar12.
if you think this is a good idea and could work can you tell me where and what to write
 
Why don't you do this, create an image control in the form, name it ocsarPic. Then in the Form Current event use.
Code:
Private Sub Form_Current()
    Me.ocsarPic.Visible = Nz(Me.bestpictureoscer, False)
End Sub
 
In your Form Design view.

attachment.php

attachment.php
 

Attachments

  • imageControl.png
    imageControl.png
    30.9 KB · Views: 245
i dont know why but it tells me that it cant find the picture. i named the picture oscarPic from the properties button of the picture itself. Then i entered the code from the properties menu on the form - event - on current - event procedure and then i entered this code:

Private Sub Form_Current()
Me.ocsarPic.Visible = Nz(Me.bestpictureoscer, False)
End Sub
 
Can you upload the Stripped DB?

How to Upload a Stripped DB.

To create a Sample DB (to be uploaded for other users to examine); please follow the steps..

1. Create a backup of the file, before you proceed..
2. Delete all Forms/Queries/Reports that are not in Question (except the ones that are inter-related)
3. Delete auxiliary tables (that are hanging loose with no relationships).
4. If your table has 100,000 records, delete 99,990 records.
5. Replace the sensitive information like Telephone numbers/email with simple UPDATE queries.
6. Perform a 'Compact & Repair' it would have brought the Size down to measly KBs..
7. (If your Post count is less than 10 ZIP the file and) Upload it..

Finally, please include instructions of which Form/Query/Code we need to look at. The preferred Access version would be A2003-A2007 (.mdb files)
 
i cant save it in any other file format. it tells me that i have used features that are only available in this access version
 
i want the little star picture in the form to appear when the check box is checked and not appear when the check box isn't checked.
 

Attachments

The reason the below did not work is because of a typo :eek: (ocsar should be changed to oscar)...

Code:
Private Sub Form_Current()
Me.oscarPic.Visible = Nz(Me.bestpictureoscer, False)
End Sub
 
And, as long as I am passing by...

When I downloaded your database I noticed you are using Reserved Words as field names in tables, i.e. Name. This should be avoided as it causes issues for Access and later on, you. For a complete list of Reserved Words, see...

http://allenbrowne.com/AppIssueBadWord.html

So you could avoid that in the future a suggestion would be to adapt a Naming Convention, see...

http://www.granite.ab.ca/access/tablefieldnaming.htm
http://www.access-diva.com/d1.html

And, because it looks like you are new to Access, here's some links to help you on your journey...

Jeff Conrad's resources page...
http://www.accessmvp.com/JConrad/accessjunkie/resources.html

The Access Web resources page...
http://www.mvps.org/access/resources/index.html

A free tutorial written by Crystal (MS Access MVP)...
http://allenbrowne.com/casu-22.html

MVP Allen Browne's tutorials...
http://allenbrowne.com/links.html#Tutorials

UtterAccess Newcomer's Reading List
http://www.utteraccess.com/forum/Newcomer-s-Reading-List-t1998783.html

Sample data models...
http://www.databasedev.co.uk/table-of-contents.html
http://www.databaseanswers.org/data_models/


Other helpful tips…

Setting up a Model Database
http://www.access-diva.com/d11.html

My Database Standards...
http://regina-whipp.com/blog/?p=102
 
thank you again ! If i wanna add another picture connected to a different check box field in the table should i just copy paste the code with the changed names? i tried that and it didn't work for both pictures then
 
It should. Try again and check spelling and if youhave a problem post back.
 
this is the error it shows me
the expression On Current you entered as the event property setting produced the following error: Ambiguous name detected": Form_Current
I guess I'm missing again something : |

the check box name is - dropbox the new picture name is oscarmonkey
and the code i wrote under the first one is

Private Sub Form_Current()
Me.oscarmonkey.Visible = Nz(Me.dropbox, False)
End Sub
 

Users who are viewing this thread

Back
Top Bottom