If statement

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!
 
S

Stuart McCall

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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top