View Full Version : Code worked before now doesn't


shaneb
03-22-2002, 07:06 PM
Can someone please tell me why this will no longer work. It worked fine when I ran it with different reports and it still works when I run the "Reclamas By All" Report. This code is used in conjuction with a dialog box that has a list of reports. A user clicks on the reports and that report comes open or it prints the report depending on a selected radio button.

The reports that this code is not working with have queries that have at least one DLookUp and at least one calculated field. Is it because of these query's that I can't get it to do what it did before?

I'm getting the following error:

Run-time error '3071':

This expression is typed incorrectly, or it is to complex to be evaluated. For example, a numeric expression may contain too many complicated elements. Try simplifying the expression by assigning parts of the expression to variables.

Here is the code
---------------------------------

Private Sub Command3_Click()
Dim WClause
Dim Report1 As String
Dim Report2 As String
Dim Report3 As String

Report1 = "Reclamas By FY And DODIC"
Report2 = "Reclamas By FY"
Report3 = "Reclamas By All"

If [ReportList] = Report1 Then
Report1 = "Reclamas By FY And DODIC"
WClause = "[Report] = '" & [ReportList] & ","
DoCmd.OpenReport Reportname:="ReclamasByFYAndDODIC", View:=Me![OutputTo]
DoCmd.RunCommand acCmdZoom75
End If

If [ReportList] = Report2 Then
Report2 = "Reclamas By FY"
WClause = "[Report] = '" & [ReportList] & ","
DoCmd.OpenReport Reportname:="ReclamasByFY", View:=Me![OutputTo]
DoCmd.RunCommand acCmdZoom75
End If

If [ReportList] = Report3 Then
Report3 = "Reclamas By All"
WClause = "[Report] = '" & [ReportList] & ","
DoCmd.OpenReport Reportname:="ReclamasByAll", View:=Me![OutputTo]
DoCmd.RunCommand acCmdZoom75
End If

End Sub
-------------------------------------------