B
Bryan Hughes
Hello,
How would I make these two Queries into an Union Query in a strSQL string?
Here is what I have:
***Query 1***
strSQL = "SELECT [Unique ID], Sum([Amount]) AS [TotalDonation], [Entrydate]
"
strSQL = strSQL & "FROM ThankYouDetails As TYD "
strSQL = strSQL & "WHERE DateValue([ThankYouDetails].[Entrydate]) >=#"
strSQL = strSQL & DateValue(dtmMyStartDate) & "# And "
strSQL = strSQL & "DateValue([ThankYouDetails].[Entrydate]) <=#"
strSQL = strSQL & DateValue(dtmMyEndDate) & "# "
strSQL = strSQL & "GROUP BY [Unique ID], [Entrydate] "
strSQL = strSQL & "HAVING (Sum([ThankYouDetails].[Amount]) > 0) "
strSQL = strSQL & "ORDER BY [Entrydate] DESC;"
***Query 2***
strSQL = "SELECT [Unique ID], Sum([Amount]) AS [Total Donation], [Entrydate]
"
strSQL = strSQL & "FROM [Donation details] As DD"
strSQL = strSQL & "WHERE DateValue([Donation details].[Entrydate]) >=#"
strSQL = strSQL & DateValue(dtmMyStartDate) & "# And "
strSQL = strSQL & "DateValue([Donation details].[Entrydate]) <=#"
strSQL = strSQL & DateValue(dtmMyEndDate) & "# "
strSQL = strSQL & "GROUP BY [Unique ID], [Entrydate] "
strSQL = strSQL & "HAVING (Sum([Donation details].Amount)) > 0) "
strSQL = strSQL & "ORDER BY [Entrydate] DESC;"
How would I write this as strSQL string as a Union Query?
-TFTH
-Bryan
How would I make these two Queries into an Union Query in a strSQL string?
Here is what I have:
***Query 1***
strSQL = "SELECT [Unique ID], Sum([Amount]) AS [TotalDonation], [Entrydate]
"
strSQL = strSQL & "FROM ThankYouDetails As TYD "
strSQL = strSQL & "WHERE DateValue([ThankYouDetails].[Entrydate]) >=#"
strSQL = strSQL & DateValue(dtmMyStartDate) & "# And "
strSQL = strSQL & "DateValue([ThankYouDetails].[Entrydate]) <=#"
strSQL = strSQL & DateValue(dtmMyEndDate) & "# "
strSQL = strSQL & "GROUP BY [Unique ID], [Entrydate] "
strSQL = strSQL & "HAVING (Sum([ThankYouDetails].[Amount]) > 0) "
strSQL = strSQL & "ORDER BY [Entrydate] DESC;"
***Query 2***
strSQL = "SELECT [Unique ID], Sum([Amount]) AS [Total Donation], [Entrydate]
"
strSQL = strSQL & "FROM [Donation details] As DD"
strSQL = strSQL & "WHERE DateValue([Donation details].[Entrydate]) >=#"
strSQL = strSQL & DateValue(dtmMyStartDate) & "# And "
strSQL = strSQL & "DateValue([Donation details].[Entrydate]) <=#"
strSQL = strSQL & DateValue(dtmMyEndDate) & "# "
strSQL = strSQL & "GROUP BY [Unique ID], [Entrydate] "
strSQL = strSQL & "HAVING (Sum([Donation details].Amount)) > 0) "
strSQL = strSQL & "ORDER BY [Entrydate] DESC;"
How would I write this as strSQL string as a Union Query?
-TFTH
-Bryan