Hi
I am getting the following error when i click cmdFFR (See note1): Invalid SQL statement, expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE'. I can't figure out why this is. Spelling all seems to be correct.
Public Dimensions are as follow:
(Note1)
qryCountYearsPerReceipt (from Private Sub cmdFFR_Click) above is made via Query Builder the code is as follows:
qryGroupByYearsPerReceipt (which is a query from which qryCountYearsPerReceipt is made) is also made by the query builder and code is as follows :
I have tried looking up reference books, google, examples from other recordset functions i have done which are working fine (but those are all strings I have written in VBA they are not this complex), I have tried being frustrated and I have tried pulling my hair, nothing is working. Any help would be much appreciated.
I am getting the following error when i click cmdFFR (See note1): Invalid SQL statement, expected 'DELETE', 'INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE'. I can't figure out why this is. Spelling all seems to be correct.
Public Dimensions are as follow:
Code:
Option Compare Database
Option Explicit
Public cnn As ADODB.Connection
Public rst As New ADODB.Recordset
Code:
Private Sub cmdFFR_Click()
Dim intFFR As Byte
Set cnn = CurrentProject.Connection
rst.Open "qryCountYearsPerReceipt", cnn, adOpenKeyset, adLockOptimistic
With rst
intAddFFRYears = !CountOfYear
End With
End Sub
qryCountYearsPerReceipt (from Private Sub cmdFFR_Click) above is made via Query Builder the code is as follows:
Code:
SELECT qryGroupByYearsPerReceipt.ReceiptID, Count(qryGroupByYearsPerReceipt.Year) AS CountOfYear
FROM qryGroupByYearsPerReceipt
GROUP BY qryGroupByYearsPerReceipt.ReceiptID
HAVING (((qryGroupByYearsPerReceipt.ReceiptID)=[Forms]![frmFFR]![cboRcptID]));
qryGroupByYearsPerReceipt (which is a query from which qryCountYearsPerReceipt is made) is also made by the query builder and code is as follows :
Code:
SELECT qryGroupByYearsPerReceipt.ReceiptID, Count(qryGroupByYearsPerReceipt.Year) AS CountOfYear
FROM qryGroupByYearsPerReceipt
GROUP BY qryGroupByYearsPerReceipt.ReceiptID
HAVING (((qryGroupByYearsPerReceipt.ReceiptID)=[Forms]![frmFFR]![cboRcptID]));
I have tried looking up reference books, google, examples from other recordset functions i have done which are working fine (but those are all strings I have written in VBA they are not this complex), I have tried being frustrated and I have tried pulling my hair, nothing is working. Any help would be much appreciated.