Using variables in dates (1 Viewer)

sam1fletcher

Registered User.
Local time
Today, 08:40
Joined
Jan 28, 2013
Messages
40
hi all
i would like to use a variable for the year in my date range.

this it what i thought it would be:

Code:
Dim ye as integer
ye = 2013

If Sdate < #4/1/ye# then
'do something
Else
'do Something
end if

Obviousely this is wrong. the first line of the if statement is higfhlighted

any ideas

Sam
 

CJ_London

Super Moderator
Staff member
Local time
Today, 08:40
Joined
Feb 19, 2013
Messages
16,744
try
if SDate<datevalue("04/01/" & ye) then
 

pr2-eugin

Super Moderator
Local time
Today, 08:40
Joined
Nov 30, 2011
Messages
8,494
How about..
Code:
Dim ye as Integer
ye = 2013

If Sdate < [URL="http://www.techonthenet.com/access/functions/date/dateserial.php"]DateSerial([/URL]ye, 4, 1) Then
    [COLOR=SeaGreen]'do something[/COLOR]
Else
   [COLOR=SeaGreen] 'do Something[/COLOR]
End If
 

Users who are viewing this thread

Top Bottom