pictures show after information in a field

yea i made it to a number field. i put values from 1 to 10 and the picture doesn't show
 
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
 
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
 
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.
 
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
 
i experiment on it and its quite messy. i have a lot of fields that i don't use
 
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

Last edited:
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.
 
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
 
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)
 
now my access breaks down :| when i enter a value and click to another box.
 
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
 
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
 
well you make it look easy : ) ! thank you! its great : )
 
It is one of the easiest things you'll do :)
You're welcome!
 
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
 
Change 10 to 27 and 11 to 28.

And please remember to put code within code tags.
 

Users who are viewing this thread

Back
Top Bottom