Home ElseIf statement skipped when it shouldn't be with "or"
Reply: 0

ElseIf statement skipped when it shouldn't be with "or"

user1677
1#
user1677 Published in May 23, 2018, 7:17 am

I'm building a little program to help out with some data imports and for our techs when out on sites.

The bit I'm struggling with is the bp check, see code below:

Private Sub bphg_afterupdate()

'blood pressure values
'below 100/60 - low
'120/70 - normal
'140/90 - high, gp review
'180/100 - high, cut off for fitness for driving
'200/100 - high, cut off for driving/spiro
'230/120 - urgent review required


    If bpmm <= 100 Or bphg <= 60 Then
        bpcomment.Value = "LOW! - Seek Advice"
    ElseIf bpmm < 140 Or bphg < 90 Then
        bpcomment.Value = "Normal BP"
    ElseIf bpmm < 180 Or bphg < 100 Then
        bpcomment.Value = "High! - GP Review"
    ElseIf bpmm < 200 Then
        bpcomment.Value = "High! - Temp restriction to driving MPE/FLT"
    ElseIf bpmm < 230 Or bphg < 120 Then
        bpcomment.Value = "High! - To high for Spiro & Temp Driving Resitricion MPE/FLT"
    Else
        bpcomment.Value = "URGENT! - Review required"
    End If

End Sub

What it's doing is finding the first value that fits in either the values specified and then stopping. It should be continuing to check other criteria.

So basically with blood pressure, out of the 2 figures your doctor gives you, either can determine if your bp is ok or not. So when we enter a bp into the form say 200/80 (you would probably never get this but I'm being through), it would find that the first figure is high and the second is normal. My script however is finding the second figure being normal first without checking the first figure, so it just displays "normal" when in fact it's "high".

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.377375 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO