prmitchell
Registered User.
- Local time
- Tomorrow, 00:03
- Joined
- Jan 2, 2013
- Messages
- 58
I have the onlick of a button programmed with
Dim stDocName As String
Dim stCriteria As String
stDocName = "Rallies this year"
stCriteria = "[Year of Rally] = " & Year(Date)
MsgBox (stCriteria)
DoCmd.OpenReport stDocName, acViewPreview, "", "", stCriteria
the output in the msgbox is [Year of Rally] = 2013 which seems fine
but the OpenReport command then gives me a type mismatch error
the [Year of Rally] is a calculated field in the query - the record source.
I have tried
stCriteria = "[queryname].[Year of Rally] = " & Year(Date)
and same problem
suggestions please.
Peter
Dim stDocName As String
Dim stCriteria As String
stDocName = "Rallies this year"
stCriteria = "[Year of Rally] = " & Year(Date)
MsgBox (stCriteria)
DoCmd.OpenReport stDocName, acViewPreview, "", "", stCriteria
the output in the msgbox is [Year of Rally] = 2013 which seems fine
but the OpenReport command then gives me a type mismatch error
the [Year of Rally] is a calculated field in the query - the record source.
I have tried
stCriteria = "[queryname].[Year of Rally] = " & Year(Date)
and same problem
suggestions please.
Peter