Not giving an error but not getting records back yet since the where clause is still kicking my butt.
The Scope parameter is for specifying which field the From and To date range encompus. If the Scope is CreatedDate then the where clause will be looking in that field. If the Scope is LastUpdated then @Scope looks at that.
So I am trying to get something like this to work.
VB Code:
WHERE IF (@Scope = 'Created') BEGIN (((@From Is Null) OR (CONVERT(nvarchar(10), [tblLoans].Created, 101) >= @From)) AND ((@To Is Null) OR (CONVERT(nvarchar(10), [tblLoans].Created, 101) <= @To))) AND END IF (@Scope = 'Last Updated') BEGIN (((@From Is Null) OR (CONVERT(nvarchar(10), [tblLoans].Last_Updated, 101) <= @From)) AND ((@To Is Null) OR (CONVERT(nvarchar(10), [tblLoans].Last_Updated, 101) <= @To))) AND END IF (@Scope = 'Date Submitted') BEGIN (((@From Is Null) OR (CONVERT(nvarchar(10), [tblLoans].DateSubmitted, 101) >= @From)) AND ((@To Is Null) OR (CONVERT(nvarchar(10), [tblLoans].DateSubmitted, 101) <= @To))) AND END ((@Status Is Null) OR ([tblLoans].Status = @Status))





Reply With Quote