I missed that in the second example, June7 reversed the test from =0 to <>. I never thought much about testing that the condition is the NOT what I expect or want it to be and directing flow based on that. So I now see the logic in what was written. Another simple situation I have is where a string should be "", otherwise one or more required controls have no data.
If svlist2 <> "" ThenMsgBox svList & svlist2, vbOKOnly, "Missing Information"
Exit Sub
End If
To write
If svList2="" thendo things
do more things
end if
means everything in between is dependent on the conditions being right rather than testing for failure in a compartmentalized way and bugging out then. I'm thinking that if there are multiple conditions that have to be tested, all will have to be nested. If I understand your meaning, you would do this:
If svList = "" then 'good, no required data missingdo some stuff
If intTest >0 Then
keep doing stuff
If a < b then
msgBox "So far, so good"
set rs = db.operecordset ("someQuery")
if rs.count<>0 then
select case rs.recordcount
case 1
msgbox "message if 1 record"
case is >1
msgbox "message if more than 1"
case moreCases
do moreCases stuff
end select
end if
end if
end if
end if
If that's how you do it, I don't say it is wrong, but I don't think I will adopt that approach. I will look for better examples tomorow.
Thanks.