Hi,
I have written a macro in Access VBA which executes a DCount on a query and if the DCount is above 1 it opens and prints a report. However when it gets to the line of code which opens the report it stops and debugs producing an error of "run time error 3071: This expression is typed incorrectly, or it is too complex to be evaluated"
The code I have created is below and I have highlighted the line it debugs on in red:
Dim ref As String
Dim ref2 As String
Dim strSQL As String
Set db = CurrentDb()
ref = Me.Text22.Value
strSQL = DCount("ReBoxed", "Files", "ReBoxed = " & ref)
ref2 = strSQL
If ref2 > 1 Then
DoCmd.OpenReport "Reboxed", acViewPreview
End If
I have tried reducing it because at first I had
DoCmd.OpenReport "Reboxed", acViewPreview,,,acWindowNormal
However it kept producing that error.Does anyone know why it keeps debugging on that line?
Thanks,
jeskit
Bookmarks