dapfeifer
Bringing Maverick Mojo
- Local time
- Today, 06:36
- Joined
- Jun 17, 2008
- Messages
- 68
Hey all,
Is the following statement syntactically correct?
I don't have a problem with the query loading in the above form, but access kindly decides that it needs to be changed to this form:
Then when I go to use the query in a form or report access throws an error regarding the SELECT statment inside of the from statement. I've bolded the offensive statements. Any ideas to correct the issue?
Is the following statement syntactically correct?
Code:
SELECT tblFD.Payor_Code AS [Payor Code], tblFD.Payor_Name AS [Payor Name], tblFD.SRCol AS [S/R], Sum(tblFD.Inbnd_Bytes) AS [Inbound Bytes], Sum(tblFD.Otbnd_Bytes) AS [Outbound Bytes], Sum(tblFD.Bytes) AS Bytes, Sum(tblFD.Billable_Bytes) AS [Billable Bytes], Sum(tblFD.Amount) AS Amount, Year(tblFD.Date_Entered) AS [Year]
FROM tblFinalData AS tblFD, [B](SELECT Max(Date_Entered) as maxDate FROM tblFinalData)[/B] [B]AS maxResults[/B]
WHERE (((tblFD.SRCol) Is Not Null) And ((tblFD.Date_Entered) Between DateSerial(Year(maxResults.maxDate)-1,1,1) And Year(Now())-1))
GROUP BY tblFD.Payor_Code, tblFD.Payor_Name, tblFD.SRCol, Year(tblFD.Date_Entered);
I don't have a problem with the query loading in the above form, but access kindly decides that it needs to be changed to this form:
Code:
SELECT tblFD.Payor_Code AS [Payor Code], tblFD.Payor_Name AS [Payor Name], tblFD.SRCol AS [S/R], Sum(tblFD.Inbnd_Bytes) AS [Inbound Bytes], Sum(tblFD.Otbnd_Bytes) AS [Outbound Bytes], Sum(tblFD.Bytes) AS Bytes, Sum(tblFD.Billable_Bytes) AS [Billable Bytes], Sum(tblFD.Amount) AS Amount, Year(tblFD.Date_Entered) AS [Year]
FROM tblFinalData AS tblFD, [B][SELECT Max(Date_Entered) as maxDate FROM tblFinalData][/B] [B]AS maxResults[/B]
WHERE (((tblFD.SRCol) Is Not Null) And ((tblFD.Date_Entered) Between DateSerial(Year(maxResults.maxDate)-1,1,1) And Year(Now())-1))
GROUP BY tblFD.Payor_Code, tblFD.Payor_Name, tblFD.SRCol, Year(tblFD.Date_Entered);
Then when I go to use the query in a form or report access throws an error regarding the SELECT statment inside of the from statement. I've bolded the offensive statements. Any ideas to correct the issue?