G
George Papadopoulos
I have written the code below (courtesy of Nikos Yannacopoulos) :
Private Sub btnReport_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("query_Anafora_bash_aitias_blabhs")
On Error GoTo no_record
rst.MoveLast
On Error GoTo 0
rst.Close
Set rst = Nothing
Set db = Nothing
If IsDate(Me.From_Date) Then dtFrom_Date = Me.From_Date
If IsDate(Me.To_Date) Then dtTo_Date = Me.To_Date
If (Me.btnKakh_xrhsh) Then
DoCmd.OpenReport "Anafora_bash_aitias_blabhs_kakh_xrhsh", acViewPreview
Else
DoCmd.OpenReport "Anafora_bash_aitias_blabhs_fysiologikh_f8ora",
acViewPreview
End If
Exit Sub
no_record:
MsgBox ("Aai anYeceai aaanaoYo")
End Sub
The code now fails with a syntax error at the statement
Set rst = db.OpenRecordset("query_Anafora_bash_aitias_blabhs").
The error states that more arguments are needed. I had the idea that all
other arguments
to the OpenRecordset method were optional. Is this not the case?
Private Sub btnReport_Click()
Dim db As DAO.Database
Dim rst As DAO.Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("query_Anafora_bash_aitias_blabhs")
On Error GoTo no_record
rst.MoveLast
On Error GoTo 0
rst.Close
Set rst = Nothing
Set db = Nothing
If IsDate(Me.From_Date) Then dtFrom_Date = Me.From_Date
If IsDate(Me.To_Date) Then dtTo_Date = Me.To_Date
If (Me.btnKakh_xrhsh) Then
DoCmd.OpenReport "Anafora_bash_aitias_blabhs_kakh_xrhsh", acViewPreview
Else
DoCmd.OpenReport "Anafora_bash_aitias_blabhs_fysiologikh_f8ora",
acViewPreview
End If
Exit Sub
no_record:
MsgBox ("Aai anYeceai aaanaoYo")
End Sub
The code now fails with a syntax error at the statement
Set rst = db.OpenRecordset("query_Anafora_bash_aitias_blabhs").
The error states that more arguments are needed. I had the idea that all
other arguments
to the OpenRecordset method were optional. Is this not the case?