pictures show after information in a field (1 Viewer)

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
yea i made it to a number field. i put values from 1 to 10 and the picture doesn't show
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
I think you're misunderstanding what I'm saying. Copy and paste this code exactly as it is:
Code:
    Dim imgArray(1 To 10) As Byte

    For i = LBound(imgArray) To UBound(imgArray)
        Me.Controls("imgStar" & i).Visible = (i <= 5)
    Next
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
i did it. also i write the code in the after update from the properties of my field named rating and the picture named imgStar doesnt show no matter what rating i put
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
You're still not fully understanding.

Your image should not be called just imgStar. The first image control should be called imgStar1, the second image control imgStar2 and so on. Have you done that?

Also, you enter the number in the rating box AND move the cursor to another control.
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
yea i have 10 images and i named them imgStar1 imgStar2 imgStar3 imgStar4 imgStar5 imgStar6 imgStar7 imgStar8 imgStar9 imgStar10. i copied the code. and i change the records in my form
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
i experiment on it and its quite messy. i have a lot of fields that i don't use
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
The oscar pictures in the middle of the form are the ones I'm talking about. i deleted most of the stuff and made it more compact.
the field rating is the last one in the table
 

Attachments

  • New Microsoft Access Database (2).accdb
    892 KB · Views: 66
Last edited:

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
You've not done everything that I advised.

I mentioned that you should set the Visible property of ALL the controls to No. And I also mentioned that you need to enter a value in the Rating textbox AND move to another textbox.

Please try and follow what we're asking you to do. If you don't understand, just ask.
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
i changed the value to no but then i added the other pictures and i forgot about that. sorry here its 2 am and im not thinking that good and also i dont understand much of access

what do you mean to another text box? and ive entered values in the rating textbox the first 10 record have values
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
The AfterUpdate event works after you move to another control.

1. Enter a number inside Rating
2. Click inside any of your other controls (for example Director)
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
now my access breaks down :| when i enter a value and click to another box.
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
but in the file i send you which is the shorter version it shows 5 oscars when i've entered rating 3.
actually it shows 5 oscars no matter what rating i put
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
idk it just closed up and wanted to find a solution from the internet. but when i did it on the new file where i deleted some of the stuff and uploaded here it showed me 5 pics. so lets work with that
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
Have a look.
 

Attachments

  • New Microsoft Access Database (2).accdb
    876 KB · Views: 64

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
well you make it look easy : ) ! thank you! its great : )
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
It is one of the easiest things you'll do :)
You're welcome!
 

Pinkoto

Registered User.
Local time
Yesterday, 17:03
Joined
Jun 25, 2014
Messages
73
if i want to make this work for more than 10 pictures what should i change in the code?
for example 20 pictures

Private Sub rating_AfterUpdate()
Dim imgArray(1 To 10) As Byte

If Nz(Me.rating, 0) > 0 And Nz(Me.rating, 0) < 11 Then
For i = LBound(imgArray) To UBound(imgArray)
Me.Controls("imgStar" & i).Visible = (i <= Me.rating)
Next
Else
For i = LBound(imgArray) To UBound(imgArray)
Me.Controls("imgStar" & i).Visible = False
Next
End If
End Sub
 

vbaInet

AWF VIP
Local time
Today, 01:03
Joined
Jan 22, 2010
Messages
26,374
Change 10 to 27 and 11 to 28.

And please remember to put code within code tags.
 

Users who are viewing this thread

Top Bottom