Change image based on value from text box

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that allows a user to enter a value and would like for the
StatusFrame (image) next to the value to change images based on the value. I
tried using the following vba script. I have only been using access and vba
for two weeks and have not found any other post that involves using values to
determine which image is shown. Below is the script that I have tried to
use, but I must be doing something wrong. (The file path is shortened since
it is on a network drive) Any help would be greatly appreciated.

Private Sub setStatusPath()
Dim strStatusPath As String
strStatusPath = Me.Cpk
Me.StatusFrame.Picture = Cpk

If Cpk > 1.33 Then
Me.StatusFrame.Picture = "J:...\good.BMP"
ElseIf Cpk2 < 1 Then
Me.StatusFrame.Picture = "J:...low.BMP""
End If

End Sub
 
Marc,

Try this code. If you have a textbox that is named "Text11", when you leave
the textbox the picture (image control) should change whether the value is
more than 1.33 or less than or equal to 1.33 .

Is this close to what you are trying to do?

'-------------------Start Code
Private Sub Text11_Afterupdate()

If Me.Text11 > 1.33 Then
Me.StatusFrame.Picture = "J:...\good.BMP"
Else
Me.StatusFrame.Picture = "J:...low.BMP"""
End If

End Sub
'-------------------End Code

HTH

Steve
 
Back
Top