D
Dnld
I am learning VBA for Access. On the form I have Text Box "Cat" and
Combo Box "CatCb". CatCb data source has 6 values including "Dr", "Pt"
and the last value "Undefined". I have class module as follows
Private Sub CatCb_AfterUpdate()
If Nz(Cat.Value) = "" Then
Cat.Value = CatCb
ElseIf Cat.Value <> "Undefined" And CatCb = "Undefined" And
MsgBox("Replace all current Categories with 'Undefined'?", vbYesNo,
"Categories") = vbYes Then
Cat.Value = CatCb
Else
Cat.Value = Cat + " " + CatCb
End If
End Sub
I would think that for ElseIf condition, when 1st or 2nd condition is
not true (that is if Cat.value is already "Undefined" or CatCb is not
"Undefined"), the message box should not even pop up, but it does. I
do not know what I am missing? Any help?
Combo Box "CatCb". CatCb data source has 6 values including "Dr", "Pt"
and the last value "Undefined". I have class module as follows
Private Sub CatCb_AfterUpdate()
If Nz(Cat.Value) = "" Then
Cat.Value = CatCb
ElseIf Cat.Value <> "Undefined" And CatCb = "Undefined" And
MsgBox("Replace all current Categories with 'Undefined'?", vbYesNo,
"Categories") = vbYes Then
Cat.Value = CatCb
Else
Cat.Value = Cat + " " + CatCb
End If
End Sub
I would think that for ElseIf condition, when 1st or 2nd condition is
not true (that is if Cat.value is already "Undefined" or CatCb is not
"Undefined"), the message box should not even pop up, but it does. I
do not know what I am missing? Any help?