G
Gus Chuch
I got a form with a ListBox that has the following RowSource
SELECT IIf([SumOfCommission]>600,"X","") AS Chk, tblLocation.Name,
Sum(tblIncomeSum.Commission) AS SumOfCommission
FROM tblLocation INNER JOIN tblIncomeSum ON tblLocation.LocationID =
tblIncomeSum.LocationID
WHERE (((Year(([tblIncomeSum].[Date])))=Year(Date())-1))
GROUP BY tblLocation.Name;
And it works fine when the form is opened. But after I do a update to a text
box I run the following code pretty much the same SQL just the year(Date())-1
is changed
Dim strSQL As String
strSQL = "SELECT IIf([SumOfCommission]>600,""X"","") AS Chk,
tblLocation.Name, Sum(tblIncomeSum.Commission) AS SumOfCommission " & _
"FROM tblLocation INNER JOIN tblIncomeSum ON
tblLocation.LocationID = tblIncomeSum.LocationID " & _
"WHERE (((Year(([tblIncomeSum].[Date]))) =
[forms]![frmTaxForm]![txtYear])) " & _
"GROUP BY tblLocation.Name;"
lstLocationName.RowSource = strSQL
The ListBox now is empty, Why? I came to the conclusion that my IIF
STATEMENT is to blame because it will work if I don’t use the IIF STATEMENT.
What's up with that??
Any ideas??
SELECT IIf([SumOfCommission]>600,"X","") AS Chk, tblLocation.Name,
Sum(tblIncomeSum.Commission) AS SumOfCommission
FROM tblLocation INNER JOIN tblIncomeSum ON tblLocation.LocationID =
tblIncomeSum.LocationID
WHERE (((Year(([tblIncomeSum].[Date])))=Year(Date())-1))
GROUP BY tblLocation.Name;
And it works fine when the form is opened. But after I do a update to a text
box I run the following code pretty much the same SQL just the year(Date())-1
is changed
Dim strSQL As String
strSQL = "SELECT IIf([SumOfCommission]>600,""X"","") AS Chk,
tblLocation.Name, Sum(tblIncomeSum.Commission) AS SumOfCommission " & _
"FROM tblLocation INNER JOIN tblIncomeSum ON
tblLocation.LocationID = tblIncomeSum.LocationID " & _
"WHERE (((Year(([tblIncomeSum].[Date]))) =
[forms]![frmTaxForm]![txtYear])) " & _
"GROUP BY tblLocation.Name;"
lstLocationName.RowSource = strSQL
The ListBox now is empty, Why? I came to the conclusion that my IIF
STATEMENT is to blame because it will work if I don’t use the IIF STATEMENT.
What's up with that??
Any ideas??