If statement

  • Thread starter Thread starter Peter
  • Start date Start date
P

Peter

Hi all again

what is wrong with this sub?

Private Sub Minutes_AfterUpdate()
If Me.Minutes.Value = ">0" Then
Me.Recieved.Value = "Yes"
End If
End Sub

In other words...if the value is more then 0 in the minues controll...the
received controll should become "yes"...

you can get crazy for less :-)

Thanks!
 
Peter said:
Hi all again

what is wrong with this sub?

Private Sub Minutes_AfterUpdate()
If Me.Minutes.Value = ">0" Then
Me.Recieved.Value = "Yes"
End If
End Sub

In other words...if the value is more then 0 in the minues controll...the
received controll should become "yes"...

you can get crazy for less :-)

Thanks!

Because you've included >0 in quotes, your code is comparing
me.minutes.value to the two characters > and 0. A neater way would be:

Me.Recieved.Value = Iif(Me.Minutes.Value >0, "Yes", "")

or

Me.Recieved.Value = Iif(Me.Minutes.Value >0, "Yes", "No")
 
Back
Top