pictures show after information in a field

Pinkoto

Registered User.
Local time
Today, 14:58
Joined
Jun 25, 2014
Messages
73
Hello,
My idea is to have a field in my table that have ratings for example - 1,2,3,4,5,6,7,8,9,10.
How can i make one star.jpg image to appear when I've entered rating 1, two stars to appear when I've entered rating 2, 3 stars for rating 3 and etc....
Is that even possible? If it isn't is there any other way i can make this?
 
Yes, this can be done. However, you will not be making the same star appear multiple times, it will be easier for you if you have 10 images of stars on your Form and we make them Visible = True/False based off your rating selection.
 
I need the same advise from you guys

I have two table data base (Patient Info) + (Referral Info) with one to many relationship.

I devised a form to display patients information and their mental health diagnosis.

On my referral form (subform) I have I have list box facility with various possible diagnosis. What I want to do is ... if the user selected "Dementia" from the look up/list box...

I want to display a Butterfly next to the patient's name (Main form)

(1) I don't want the picture to be in C drive rather I want the picture to be part of the database

(2) How can I put the conditional display (if Diagnosis is "dementia" then Butterfly)

Thanks for your advise/support
 
Indi123,

It's best you create your own thread or watch this one.
 
so how can it be done with 10 star picture? What and where should i do?
I'll insert 10 pictures but how can i make one appear if I've made the rating 1 and make 8 of the pictures appear if I've put rating 8 for example
 
Last edited:
In the absence of Gina, I see that your case is actually different from Indi123.

First you need to name the image controls using this sort of format:
imgStar1
imgStar2
imgStar3
... etc

Once you've done that we can work on the code.
 
i can change the names when i have the code : ). but lets say the names of the images are image1 image2 image3 image4 etc.
 
The names and the sequence in which they're done are very important.

Here's some aircode:
Code:
dim imgArray(1 to 10) as byte

for i = lbound(imgArray) to ubound(imgArray)
    me.controls("imgStar" & i).visible = (i <= [COLOR="Red"]rating[/COLOR])
next
Put this in the AfterUpdate event of the ratings control.

To test it, swap "rating" highlighted in red for a number like 5 and change a value in your ratings control.
 
Once you get it working, I'll tell you where else the code needs to go.
 
i put the code in the after update of the rating field and instead of imgStar put the name of the first image which is Image192. Then when i put rating 1 in the field it gives me an error "run time error microsoft access cant find the field image1921"
i don't know why it says image1921.. i've entered image192.
Private Sub rating_AfterUpdate()
Dim imgArray(1 To 10) As Byte

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

End Sub
 
Please go back to my first post and rename your control as I already mentioned.
 
ok i renamed the image to imgStar .... and it still doesnt work
 
What code are you using now? And what's the error message?
What kind of control is Rating?

Also remember to set the Visible property of all those image controls to No in Design View.
 
Please number your Images 1 thru 10, not 192 or anything like that, 1 thru 10 only.
 
Private Sub rating_AfterUpdate()
Dim imgArray(1 To 10) As Byte

For i = LBound(imgArray) To UBound(imgArray)
Me.Controls("imgStar1" & i).Visible = (i <= rating)
Next
End Sub
thats the code i put
and when i entered rating 4 it shows me that it cant find image11...
 
The only part of the code you were asked to change was just rating. Please remove the "1" from "imgStar1".

Your code should be:
Code:
Private Sub rating_AfterUpdate()
    Dim imgArray(1 To 10) As Byte

    For i = LBound(imgArray) To UBound(imgArray)
        Me.Controls("imgStar" & i).Visible = (i <= Me.rating)
    Next
End Sub
 
i did that and the picture doesnt show no matter what i put in the rating. should the rating field be number or short text ?
 
I did mention that you should change rating to a number to test it first. So change "Me.Rating" to 5 and test it.
 

Users who are viewing this thread

Back
Top Bottom