Hi People,
i have got this code:
but i get the famous Error 3061 at this line
any idea?
Joe
i have got this code:
Code:
Dim ReportName As String
Dim strNadvan As String
Dim i As Integer
Dim rsQry, Rs As Recordset
Dim SQL As String
Dim QDF As QueryDef
Dim QRY As String
With CurrentDb.QueryDefs("OpenBalance")
.Parameters![What] = "P Or V"
.Parameters![Date] = Me.txtFromDate
Set rsQry = .OpenRecordset(dbOpenSnapshot, dbForwardOnly)
End With
For i = 0 To Me.lstNadvonim.ListCount - 1
If Me.lstNadvonim.Selected(i) Then
strNadvan = Me.lstNadvonim.Column(0, i)
SQL = "SELECT * FROM OpenBalance WHERE [From] = '" & strNadvan & "'"
Set Rs = CurrentDb.OpenRecordset(SQL)
strNadvan = "[Records].[From]='" & strNadvan & "'"
ReportName = "PrintStatment"
DoCmd.OpenReport ReportName, acPreview, , strNadvan
[Reports]![PrintStatment]![opBl] = Rs("SumOfAmount")
DoCmd.RunCommand acCmdPrint
DoCmd.Close acReport, ReportName, acSaveYes
Me.lstNadvonim.Selected(i) = False
End If
Next i
but i get the famous Error 3061 at this line
Code:
Set Rs = CurrentDb.OpenRecordset(SQL)
any idea?
Joe