D
Douglas J. Steele
You're going to kick yourself (I know I am!)
It's order of operation precedence. Try putting parentheses around the Or
clauses:
Private Sub Density_Exit(Cancel As Integer)
If IsNull(Me!UOM) = False Then
If (Me!UOM = "g" Or Me!UOM = "oz." Or Me!UOM = "lb.") _
And Len(Trim(Me!Density & vbNullString)) > 0 Then
Beep
MsgBox "Density must be NULL!"
Cancel = True
ElseIf Me!UOM = "fl. oz." And _
Len(Trim(Me!Density & vbNullString)) = 0 Then
Beep
MsgBox "Density is required!"
Cancel = True
End If
End If
End Sub
Sorry about that!
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
It's order of operation precedence. Try putting parentheses around the Or
clauses:
Private Sub Density_Exit(Cancel As Integer)
If IsNull(Me!UOM) = False Then
If (Me!UOM = "g" Or Me!UOM = "oz." Or Me!UOM = "lb.") _
And Len(Trim(Me!Density & vbNullString)) > 0 Then
Beep
MsgBox "Density must be NULL!"
Cancel = True
ElseIf Me!UOM = "fl. oz." And _
Len(Trim(Me!Density & vbNullString)) = 0 Then
Beep
MsgBox "Density is required!"
Cancel = True
End If
End If
End Sub
Sorry about that!
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
JohnLute said:Correction!!!I changed all of the names accordingly and still had the Exit [Density]
problem. I changed the names back and tried again. This time I noticed
that
if I selected "lb." for [Density] that everything worked fine however if
I
selected either "g" or "oz." then the Exit [Density] problem occured.
Should be:I changed all of the names accordingly and still had the Exit [Density]
problem. I changed the names back and tried again. This time I noticed
that
if I selected "lb." for [UOM] that everything worked fine however if I
selected either "g" or "oz." then the Exit [Density] problem occured.
and
That is truly puzzling. I didn't notice it before. So things have
narrowed
down! I can't Tab or click OUT of [Density] after creating a new or
editing
an existing record with "g" or "oz." selected for [Density]. Moreover
there
are no problems when "fl. oz." is selected for [Density] regardless if
I'm
creating a new or editing an existing record.
Should be:That is truly puzzling. I didn't notice it before. So things have
narrowed
down! I can't Tab or click OUT of [Density] after creating a new or
editing
an existing record with "g" or "oz." selected for [UOM]. Moreover there
are no problems when "fl. oz." is selected for [UOM] regardless if I'm
creating a new or editing an existing record.
So sorry for the confusion!