J
JohnE
I have the following sql in the code but it is not returning the proper info.
The issue is in the WHERE, AND, AND, OR lines. I am looking to return all
the records that have a WHERE, AND, AND as well as OR. I am missing
something and can't see/tell what it is.
Can someone look at this and see what more is needed?
strSQL = "SELECT BuildKey(ChangeRequestID) As NodeKey, ChangeRequest
As NodeText, BuildKey(Nz(IsChildOf,0)) As BelongTo" & _
" FROM tblChangeRequest" & _
" WHERE IsTopLevel = 1" & _
" AND ChangeRequestStatusID <> 6" & _
" AND ChangeRequestStatusID <> 7" & _
" OR IsChildOf > 0" & _
" UNION ALL SELECT TOP 1 BuildKey('<NULL>') As NodeKey,
'<Un-Assigned>' As NodeText, BuildKey(Nz(IsChildOf,0)) As BelongsTo" & _
" FROM tblChangeRequest" & _
" ORDER BY NodeText"
Thanks.
.... John
The issue is in the WHERE, AND, AND, OR lines. I am looking to return all
the records that have a WHERE, AND, AND as well as OR. I am missing
something and can't see/tell what it is.
Can someone look at this and see what more is needed?
strSQL = "SELECT BuildKey(ChangeRequestID) As NodeKey, ChangeRequest
As NodeText, BuildKey(Nz(IsChildOf,0)) As BelongTo" & _
" FROM tblChangeRequest" & _
" WHERE IsTopLevel = 1" & _
" AND ChangeRequestStatusID <> 6" & _
" AND ChangeRequestStatusID <> 7" & _
" OR IsChildOf > 0" & _
" UNION ALL SELECT TOP 1 BuildKey('<NULL>') As NodeKey,
'<Un-Assigned>' As NodeText, BuildKey(Nz(IsChildOf,0)) As BelongsTo" & _
" FROM tblChangeRequest" & _
" ORDER BY NodeText"
Thanks.
.... John