Ok guys i have had a look online and cant seem to figure out what is wrong with this.
On opening my cross tab report I get this error
Too Few parameters. Expected 0.
Attached is my sql for that query and the code on the report
HELP please
On opening my cross tab report I get this error
Too Few parameters. Expected 0.
Attached is my sql for that query and the code on the report
HELP please
Code:
PARAMETERS [Forms]![frmACCTRX]![txtDATEFROM] DateTime, [Forms]![frmACCTRX]![txtDATETO] DateTime;
TRANSFORM Sum(ACOPTBL.ACOP_TRX_AMT) AS AMOUNT
SELECT ACOPTBL.ACOP_ACCT_NO AS ACCOUNT,
ACOPTBL.ACOP_TRX_DATE AS TRXDATE,
ACOPTBL.ACOP_SYSC_NUMBER AS STORE,
ACOPTBL.ACOP_AREA_NUMBER AS AREA,
ACOPTBL.ACOP_TILL_NUMBER AS TILL,
SYSCTBL.SYSC_COMPANY,
TILLTBL.TILL_DESC,
AREATBL.AREA_DESC,
ACMFTBL.ACMF_NAME, ACMFTBL.ACMF_CURR_BALANCE
FROM SYSCTBL,
AREATBL,
TILLTBL,
ACMFTBL,
ACOPTBL
WHERE (((ACOPTBL.ACOP_TRX_DATE) Between [Forms]![frmACCTRX]![txtDATEFROM] And [Forms]![frmACCTRX]![txtDATETO])
AND ((SYSCTBL.SYSC_NUMBER)=[AREATBL].[AREA_SYSC_NUMBER]
And (SYSCTBL.SYSC_NUMBER)=[ACOPTBL].[ACOP_SYSC_NUMBER])
AND ((AREATBL.AREA_NUMBER)=[TILLTBL].[TILL_AREA_NUMBER]
And (AREATBL.AREA_NUMBER)=[ACOPTBL].[ACOP_AREA_NUMBER])
AND ((ACMFTBL.ACMF_NUMBER)=[ACOPTBL].[ACOP_ACCT_NO])
AND ((TILLTBL.TILL_NUMBER)=[ACOPTBL].[ACOP_TILL_NUMBER]))
GROUP BY ACOPTBL.ACOP_ACCT_NO,
ACOPTBL.ACOP_TRX_DATE,
ACOPTBL.ACOP_SYSC_NUMBER,
ACOPTBL.ACOP_AREA_NUMBER,
ACOPTBL.ACOP_TILL_NUMBER,
SYSCTBL.SYSC_COMPANY,
TILLTBL.TILL_DESC,
AREATBL.AREA_DESC,
ACMFTBL.ACMF_NAME,
ACMFTBL.ACMF_CURR_BALANCE,
SYSCTBL.SYSC_NUMBER,
AREATBL.AREA_NUMBER,
ACMFTBL.ACMF_NUMBER,
TILLTBL.TILL_NUMBER,
ACOPTBL.ACOP_TRX_DATE
ORDER BY ACOPTBL.ACOP_TRX_DATE
PIVOT ACOPTBL.ACOP_TRX_TYPE;
Code:
Dim rst As DAO.Recordset
Dim db As DAO.Database
Private Sub Report_Open(Cancel As Integer)
Dim i As Integer
Dim j As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("select * from crstabACCTRX")
Select Case Forms!frmACCTRX!subfrmGROUPBY!frameGROUPBY.VALUE
Case 1
Me.GroupHeader2.Visible = False
Me.GroupHeader3.Visible = False
Case 2
Me.GroupHeader1.Visible = False
Me.GroupHeader3.Visible = False
Case 3
Me.GroupHeader1.Visible = False
Me.GroupHeader2.Visible = False
End Select
Me.lbl0.Caption = ""
Me.lbl1.Caption = ""
Me.lbl2.Caption = ""
Me.lbl3.Caption = ""
Me.txt0.ControlSource = ""
Me.txt1.ControlSource = ""
Me.txt2.ControlSource = ""
Me.txt3.ControlSource = ""
rst.MoveFirst
j = -1
i = 0
For i = 0 To rst.Fields.count - 1
If rst.Fields(i).Name Like "ACCOUNT" Or "STORE" Or "AREA" _
Or "TILL" Or "SYSC_COMPANY" Or "TRX_DATE" Or _
"TILL_DESC" Or "AREA_DESC" Or "ACMF_NAME" Or _
"ACMF_CURR_BALANCE" Then GoTo skip_it
j = j + 1
Select Case j
Case 0
Me.txt0.ControlSource = rst.Fields(i).Name
Case 1
Me.txt1.ControlSource = rst.Fields(i).Name
Case 2
Me.txt2.ControlSource = rst.Fields(i).Name
Case 3
Me.txt3.ControlSource = rst.Fields(i).Name
End Select
skip_it:
Next i
rst.Close
Set rst = Nothing
End Sub
Private Sub ReportHeader_Format(Cancel As Integer, FormatCount As Integer)
Dim i As Integer
Dim j As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("select * from crstabACCTRX")
rst.MoveFirst
j = -1
i = 0
For i = 0 To rst.Fields.count - 1
If rst.Fields(i).Name Like "ACCOUNT" Or "STORE" Or "AREA" _
Or "TILL" Or "SYSC_COMPANY" Or "TRX_DATE" Or _
"TILL_DESC" Or "AREA_DESC" Or "ACMF_NAME" Or _
"ACMF_CURR_BALANCE" Then GoTo skip_it
j = j + 1
Select Case j
Case 0
Me.lbl0.Caption = rst.Fields(i).Name
Case 1
Me.lbl1.Caption = rst.Fields(i).Name
Case 2
Me.lbl2.Caption = rst.Fields(i).Name
Case 3
Me.lbl3.Caption = rst.Fields(i).Name
End Select
skip_it:
Next
rst.Close
Set rst = Nothing
End Sub