IF... then a picture (1 Viewer)

Pinkoto

Registered User.
Local time
Today, 06:32
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?
 

pr2-eugin

Super Moderator
Local time
Today, 14:32
Joined
Nov 30, 2011
Messages
8,494
How is this image brought into the form? Attachment or linking?
 

BlueIshDan

☠
Local time
Today, 10:32
Joined
May 15, 2014
Messages
1,122
Can you add a condition to a Image control?
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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.
 

pr2-eugin

Super Moderator
Local time
Today, 14:32
Joined
Nov 30, 2011
Messages
8,494
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?
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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
 

pr2-eugin

Super Moderator
Local time
Today, 14:32
Joined
Nov 30, 2011
Messages
8,494
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
 

pr2-eugin

Super Moderator
Local time
Today, 14:32
Joined
Nov 30, 2011
Messages
8,494
In your Form Design view.


 

Attachments

  • imageControl.png
    imageControl.png
    30.9 KB · Views: 177

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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
 

pr2-eugin

Super Moderator
Local time
Today, 14:32
Joined
Nov 30, 2011
Messages
8,494
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)
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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

  • accessform.accdb
    604 KB · Views: 45

GinaWhipp

AWF VIP
Local time
Today, 09:32
Joined
Jun 21, 2011
Messages
5,899
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
 

GinaWhipp

AWF VIP
Local time
Today, 09:32
Joined
Jun 21, 2011
Messages
5,899
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
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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
 

GinaWhipp

AWF VIP
Local time
Today, 09:32
Joined
Jun 21, 2011
Messages
5,899
It should. Try again and check spelling and if youhave a problem post back.
 

Pinkoto

Registered User.
Local time
Today, 06:32
Joined
Jun 25, 2014
Messages
73
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

Top Bottom