Access 2003 on Win XP
I'm using the code below to check whether patients have abnormal metabolic syndrome.
The code works fine some of the time, but occasionally it fail to pick up on the fact that txtSEX contains either 'M' or 'F. Instead, it will inform the user that 'sex not entered etc'.
Now I know for a fact the sex is entered for all patients - it is never missing. So why does it sometimes think it is.
Any ideas anyone?
TIA for any help.
mojo
I'm using the code below to check whether patients have abnormal metabolic syndrome.
The code works fine some of the time, but occasionally it fail to pick up on the fact that txtSEX contains either 'M' or 'F. Instead, it will inform the user that 'sex not entered etc'.
Now I know for a fact the sex is entered for all patients - it is never missing. So why does it sometimes think it is.
Any ideas anyone?
TIA for any help.
mojo
Code:
Dim metCount As Integer
metCount = 0
If IsNull(Me.txtSEX) Then
MsgBox ("Sex not entered. Please complete patient details."), vbOKOnly
Exit Sub
End If
If Not IsNull(Me.txtSEX) Then
If Me.txtSEX = "M" Then
If Me.txtWaist >= 90 Then
metCount = metCount + 1
Me.txtWaist.BackColor = 16642265
If Me.txtHDLCho < 1 Then
metCount = metCount + 1
Me.txtHDLCho.BackColor = 16642265
End If
If Me.txtTriglycerides >= 1.7 Then
metCount = metCount + 1
Me.txtTriglycerides.BackColor = 16642265
End If
If Me.txtGlucose0m >= 5.6 Then
metCount = metCount + 1
Me.txtGlucose0m.BackColor = 16642265
End If
If (Me.txtSystolicBP >= 130 Or Me.txtDiastolicBP >= 85) Or (Me.cmbBPTreament.Value = 1) Then
metCount = metCount + 1
If Me.txtSystolicBP >= 130 Then Me.txtSystolicBP.BackColor = 16642265
If Me.txtDiastolicBP >= 85 Then Me.txtSystolicBP.BackColor = 16642265
If Me.cmbBPTreament.Value = 1 Then Me.cmbBPTreament.BackColor = 16642265
End If
End If
End If
If Me.txtSEX = "F" Then
If Me.txtWaist >= 80 Then
metCount = metCount + 1
Me.txtWaist.BackColor = 16642265
If Me.txtHDLCho < 1.3 Then
metCount = metCount + 1
Me.txtHDLCho.BackColor = 16642265
End If
If Me.txtTriglycerides >= 1.7 Then
metCount = metCount + 1
Me.txtTriglycerides.BackColor = 16642265
End If
If Me.txtGlucose0m >= 5.6 Then
metCount = metCount + 1
Me.txtGlucose0m.BackColor = 16642265
End If
If (Me.txtSystolicBP >= 130 Or Me.txtDiastolicBP >= 85) Or (Me.cmbBPTreament.Value = 1) Then
metCount = metCount + 1
If Me.txtSystolicBP >= 130 Then Me.txtSystolicBP.BackColor = 16642265
If Me.txtDiastolicBP >= 85 Then Me.txtSystolicBP.BackColor = 16642265
If Me.cmbBPTreament.Value = 1 Then Me.cmbBPTreament.BackColor = 16642265
End If
End If
End If
End If
If metCount >= 3 Then
Me.txtMetSynGrp = 1
Me.txtMetSynCount = metCount
Me.txtBTMetSyn.Visible = True