My code below works fine but I’m not sure if it’s valid since I’ve never seen it done this way.
I’m checking one field each in three different tables to see if it has data or is null.
I only care if all three fields are null (false) or if any one of them has data (true).
If someone with more experience could let me know also I think this can be done with a single SQL statement but so far I’ve failed.
Big Thanks
mossimo
I’m checking one field each in three different tables to see if it has data or is null.
I only care if all three fields are null (false) or if any one of them has data (true).
If someone with more experience could let me know also I think this can be done with a single SQL statement but so far I’ve failed.
Code:
SqlOne="SELECT FieldOne FROM tblOne WHERE FieldOne='vToMatch'"
SqlTwo="SELECT FieldTwo FROM tblTwo WHERE FieldTwo='vToMatch'"
SqlThree="SELECT FieldThree FROM tblThree WHERE FieldThree='vToMatch'"
Set Conn=Server.Createobject("ADODB.Connection")
Conn.Open ConxString
Set RsOne=Conn.Execute(SqlOne)
Set RsTwo=Conn.Execute(SqlTwo)
Set RsThree=Conn.Execute(SqlThree)
If RsOne.EOF Then xOne=False Else xOne=True End If
If RsTwo.EOF Then xTwo=False Else xTwo=True End If
If RsThree.EOF Then xThree=False Else xThree=True End If
RsOne.Close : RsTwo.Close : RsThree.Close : Conn.Close
Set RsOne=Nothing : Set RsTwo=Nothing : Set RsThree=Nothing : Set Conn=Nothing
Big Thanks
mossimo