Having trouble executing a auto email to owner of voided lot. Lot's get voided but when running email function I get the following error.
SET NOCOUNT ON SELECT DISTINCT EMailAddress FROM Lot, Item, Person WHERE Lot.PersonID = Person.PersonID AND Lot.LotID = Item.LotID AND ItemID IN (#ValueList(EMailAddresses.EMailAddress)#) UNION
Error Occurred While Processing Request
Error Diagnostic Information
Invalid CFQUERY syntax
The error is most likely caused by one of two things:
In your template you have mismatched <CFQUERY> and </CFQUERY> tags, or,
You have omitted the SQL= attribute of a simple <CFQUERY> tag, i.e., one that has no </CFQUERY> tag associated with it.
HERE IS THE CODE FOR THE PAGE:
<!--- get the unvoided items in the lot --->
<CFQUERY NAME="Items" DATASOURCE="PDC">
SELECT ItemID FROM Item WHERE LotID = #LotID#
AND NOT EXISTS (SELECT ItemID FROM ItemVoid WHERE ItemID = Item.ItemID)
</CFQUERY>
<CFTRANSACTION>
<!--- void the items in the lot --->
<CFLOOP QUERY="Items">
<CFQUERY DATASOURCE="PDC">
SET NOCOUNT ON
INSERT INTO ItemVoid (ItemID, Reason, PersonID, Date) VALUES (#ItemID#, '#Reason#', #Cookie.CurrentPersonID#, GetDate())
</CFQUERY>
</CFLOOP>
<!--- void the lot --->
<CFQUERY DATASOURCE="PDC">
SET NOCOUNT ON
INSERT INTO Void (LotID, Reason, PersonID, Date) VALUES (#LotID#, '#Reason#', #Cookie.CurrentPersonID#, GetDate())
</CFQUERY>
</CFTRANSACTION>
<!--- determine interested people --->
<CFQUERY NAME="EMailAddresses" DATASOURCE="PDC">
SET NOCOUNT ON
<!--- created the lot --->
SELECT DISTINCT EMailAddress FROM Lot, Item, Person
WHERE Lot.PersonID = Person.PersonID AND Lot.LotID = Item.LotID
AND ItemID IN (#ValueList(EMailAddresses.EMailAddress)#)
UNION
<!--- send the email --->
<CFMAIL SUBJECT="Voided Lot #LotID#"
TO="#ValueList(EMailAddresses.EMailAddress)#"
FROM="#PrimaryAdminEMailAddress#">
Lot #LotID# was voided on #DateFormat(LotID.Date, "ddd, mmmm dd, yyyy"#
</CFMAIL>
SET NOCOUNT ON SELECT DISTINCT EMailAddress FROM Lot, Item, Person WHERE Lot.PersonID = Person.PersonID AND Lot.LotID = Item.LotID AND ItemID IN (#ValueList(EMailAddresses.EMailAddress)#) UNION
Error Occurred While Processing Request
Error Diagnostic Information
Invalid CFQUERY syntax
The error is most likely caused by one of two things:
In your template you have mismatched <CFQUERY> and </CFQUERY> tags, or,
You have omitted the SQL= attribute of a simple <CFQUERY> tag, i.e., one that has no </CFQUERY> tag associated with it.
HERE IS THE CODE FOR THE PAGE:
<!--- get the unvoided items in the lot --->
<CFQUERY NAME="Items" DATASOURCE="PDC">
SELECT ItemID FROM Item WHERE LotID = #LotID#
AND NOT EXISTS (SELECT ItemID FROM ItemVoid WHERE ItemID = Item.ItemID)
</CFQUERY>
<CFTRANSACTION>
<!--- void the items in the lot --->
<CFLOOP QUERY="Items">
<CFQUERY DATASOURCE="PDC">
SET NOCOUNT ON
INSERT INTO ItemVoid (ItemID, Reason, PersonID, Date) VALUES (#ItemID#, '#Reason#', #Cookie.CurrentPersonID#, GetDate())
</CFQUERY>
</CFLOOP>
<!--- void the lot --->
<CFQUERY DATASOURCE="PDC">
SET NOCOUNT ON
INSERT INTO Void (LotID, Reason, PersonID, Date) VALUES (#LotID#, '#Reason#', #Cookie.CurrentPersonID#, GetDate())
</CFQUERY>
</CFTRANSACTION>
<!--- determine interested people --->
<CFQUERY NAME="EMailAddresses" DATASOURCE="PDC">
SET NOCOUNT ON
<!--- created the lot --->
SELECT DISTINCT EMailAddress FROM Lot, Item, Person
WHERE Lot.PersonID = Person.PersonID AND Lot.LotID = Item.LotID
AND ItemID IN (#ValueList(EMailAddresses.EMailAddress)#)
UNION
<!--- send the email --->
<CFMAIL SUBJECT="Voided Lot #LotID#"
TO="#ValueList(EMailAddresses.EMailAddress)#"
FROM="#PrimaryAdminEMailAddress#">
Lot #LotID# was voided on #DateFormat(LotID.Date, "ddd, mmmm dd, yyyy"#
</CFMAIL>