G
Guest
how can i call a function within a query for the 'having' clause of my query.
The variable currently proceeds with "HAVING".. i was trying to trim the
variable to eliminate the word "HAVING" but am having trouble.. i am having
alot of trouble with the syntax of the function call within my query (NOT
embedded). here is my query and here is the function.. thank you.
SELECT tblRefunds.Company, tblRefunds.TaxType, tblRefunds.Date,
tblRfundAmtsToAccts.GLAccountNo, tblRfundAmtsToAccts.Amount
FROM tblRefunds INNER JOIN tblRfundAmtsToAccts ON
tblRefunds.ID=tblRfundAmtsToAccts.ID
WHERE tblRefunds.DeletedRefund=False
GROUP BY tblRefunds.Company, tblRefunds.ID, tblRefunds.Date,
tblRefunds.taxType, tblRfundAmtsToAccts.GLAccountNo,
tblRfundAmtsToAccts.Amount
HAVING GetGlobalCheck()
ORDER BY tblRefunds.TaxType DESC;
Public Function GetGlobalCheck() As String
Stop
'truncate the 'having' reserved word, because is in query
'mySQLCheck = Trim(Left(mySQLCheck, 7))
GetGlobalCheck = Eval(mySQLCheck)
End Function
The variable currently proceeds with "HAVING".. i was trying to trim the
variable to eliminate the word "HAVING" but am having trouble.. i am having
alot of trouble with the syntax of the function call within my query (NOT
embedded). here is my query and here is the function.. thank you.
SELECT tblRefunds.Company, tblRefunds.TaxType, tblRefunds.Date,
tblRfundAmtsToAccts.GLAccountNo, tblRfundAmtsToAccts.Amount
FROM tblRefunds INNER JOIN tblRfundAmtsToAccts ON
tblRefunds.ID=tblRfundAmtsToAccts.ID
WHERE tblRefunds.DeletedRefund=False
GROUP BY tblRefunds.Company, tblRefunds.ID, tblRefunds.Date,
tblRefunds.taxType, tblRfundAmtsToAccts.GLAccountNo,
tblRfundAmtsToAccts.Amount
HAVING GetGlobalCheck()
ORDER BY tblRefunds.TaxType DESC;
Public Function GetGlobalCheck() As String
Stop
'truncate the 'having' reserved word, because is in query
'mySQLCheck = Trim(Left(mySQLCheck, 7))
GetGlobalCheck = Eval(mySQLCheck)
End Function