HI Everyone
I am trying to copy the above dialog form to make selections for reports. Unfortunately Access 2003 seems to have diffferent soded and will not allow the If Is Null lines with a compile "expected end of statement" error. I have tried different methods of specifiying the condition with no effect.
Here is the current version that does not work
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
'This procedure used in Preview_Click and Print_Click Sub Procedures.
'Preview or print report selected in the SelectOptions Option Group
'Then close the QueryPIScreen Dialog form
Dim strWhereDirectorate As String
Dim strWhereDepartment As String
Dim strWhereOwner As String
strWhereDirectorate = "Directorate=Forms![QueryPIScreen]!SelectDirectorate"
strWhereDepartment = "Department =Forms![QueryPIScreen]!SelectDepartment"
strWhereOwner = "Owner=Forms![QueryPIScreen]!SelectOwner"
With Forms!QueryPIScreen
Select Case Me!SelectOption.Value
Case 1
.DoCmd.OpenReport "SelPINotRequired", PrintMode
Case 2
.DoCmd.OpenReport "SelPIreadyNotApproved", PrintMode
Case 3
. if IsNull "Forms![QueryPIScreen]!SelectDirectorate" then
DoCmd.OpenReport "LeafletsByDirectorate", PrintMode
Else
DoCmd.OpenReport "LeafletsByDirecotrate", PrintMode, , strWhereDirectorate
End If
Case 4
.If IsNull "Forms![QueryPIScreen]!SelectDepartment" then DoCmd.OpenReport "LeafletsByDepartment", PrintMode
Else
DoCmd.OpenReport "LaafletsByDepartment", PrintMode, , strWhereDepartment
End If
Case 5
.if IsNull "Forms[QueryPIScreen]!SelectOwner" then
DoCmd.OpenReport "LeafletsByOwner", PrintMode
Else
DoCmd.OpenReport "LeafletsByOWner", PrintMode, , strWhereOwner
End If
End Select
End With
DoCmd.Close acForm, "QueryPIScreen"
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
Also even thesimple coding for cases 1 and 2 does not seem to work with the Preview and Print command buttons?
Any ideas?
Regards
I am trying to copy the above dialog form to make selections for reports. Unfortunately Access 2003 seems to have diffferent soded and will not allow the If Is Null lines with a compile "expected end of statement" error. I have tried different methods of specifiying the condition with no effect.
Here is the current version that does not work
Sub PrintReports(PrintMode As Integer)
On Error GoTo Err_Preview_Click
'This procedure used in Preview_Click and Print_Click Sub Procedures.
'Preview or print report selected in the SelectOptions Option Group
'Then close the QueryPIScreen Dialog form
Dim strWhereDirectorate As String
Dim strWhereDepartment As String
Dim strWhereOwner As String
strWhereDirectorate = "Directorate=Forms![QueryPIScreen]!SelectDirectorate"
strWhereDepartment = "Department =Forms![QueryPIScreen]!SelectDepartment"
strWhereOwner = "Owner=Forms![QueryPIScreen]!SelectOwner"
With Forms!QueryPIScreen
Select Case Me!SelectOption.Value
Case 1
.DoCmd.OpenReport "SelPINotRequired", PrintMode
Case 2
.DoCmd.OpenReport "SelPIreadyNotApproved", PrintMode
Case 3
. if IsNull "Forms![QueryPIScreen]!SelectDirectorate" then
DoCmd.OpenReport "LeafletsByDirectorate", PrintMode
Else
DoCmd.OpenReport "LeafletsByDirecotrate", PrintMode, , strWhereDirectorate
End If
Case 4
.If IsNull "Forms![QueryPIScreen]!SelectDepartment" then DoCmd.OpenReport "LeafletsByDepartment", PrintMode
Else
DoCmd.OpenReport "LaafletsByDepartment", PrintMode, , strWhereDepartment
End If
Case 5
.if IsNull "Forms[QueryPIScreen]!SelectOwner" then
DoCmd.OpenReport "LeafletsByOwner", PrintMode
Else
DoCmd.OpenReport "LeafletsByOWner", PrintMode, , strWhereOwner
End If
End Select
End With
DoCmd.Close acForm, "QueryPIScreen"
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
Resume Exit_Preview_Click
End Sub
Also even thesimple coding for cases 1 and 2 does not seem to work with the Preview and Print command buttons?
Any ideas?
Regards
