I got a fill in form with field year1 and year2.
And I got the code below :
If (Not IsNull(Me.Year1)) Or (Not IsNull(Me.Year2)) Then
If IsNull(Me.Year1) Then Year1 = "2000"
If IsNull(Me.Year2) Then Year2 = "2020"
SStr = "#" & (Me.Year1) & "#"
EStr = "#" & (Me.Year2) & "#"
SQLStr = SQLStr & " AND ([Investmentplanning]![Budgetyear] Between " & SStr & " AND " & EStr & ")"
End If
But I get an error :
Syntaxiserror in date. in query-expression :
([Investmentplanning]![Budgetyear] Between "2008" AND "2012"
Does anybody know what I did wrong ?
And I got the code below :
If (Not IsNull(Me.Year1)) Or (Not IsNull(Me.Year2)) Then
If IsNull(Me.Year1) Then Year1 = "2000"
If IsNull(Me.Year2) Then Year2 = "2020"
SStr = "#" & (Me.Year1) & "#"
EStr = "#" & (Me.Year2) & "#"
SQLStr = SQLStr & " AND ([Investmentplanning]![Budgetyear] Between " & SStr & " AND " & EStr & ")"
End If
But I get an error :
Syntaxiserror in date. in query-expression :
([Investmentplanning]![Budgetyear] Between "2008" AND "2012"
Does anybody know what I did wrong ?