VBA Date problem (1 Viewer)

sam1fletcher

Registered User.
Local time
Today, 07:17
Joined
Jan 28, 2013
Messages
40
hi all

the code i have works for every other month of the the year but not for feburary.

the code is simple :: if within 2 dates then edit the recordset.

Code:
If Sdate > #2/1/2014# And Sdate < #2/30/2014# Then
.Edit
!feb2 = !feb2 + Amount
.Update
End If
If Pdate > #2/1/2014# And Pdate < #2/30/2014# Then
.Edit
!feb4 = !feb4 + Amount
.Update
End If

for some reason the 2 if statement lines bring up a compile error, syntax

anyone know the resons
 

pr2-eugin

Super Moderator
Local time
Today, 07:17
Joined
Nov 30, 2011
Messages
8,494
Sam, I do not think February has the day 30 in any of the Calender year..
Code:
If Sdate > #2/1/2014# And Sdate < [COLOR=Red][B]#2/30/2014#[/B][/COLOR] Then
    .Edit
    !feb2 = !feb2 + Amount
    .Update
End If
If Pdate > #2/1/2014# And Pdate < [COLOR=Red][B]#2/30/2014#[/B][/COLOR] Then
    .Edit
    !feb4 = !feb4 + Amount
    .Update
End If
 

sam1fletcher

Registered User.
Local time
Today, 07:17
Joined
Jan 28, 2013
Messages
40
What a nob i am thanks

sam
 

pr2-eugin

Super Moderator
Local time
Today, 07:17
Joined
Nov 30, 2011
Messages
8,494
Ha ha, that's alright Sam.. Good Luck.. :)
 

Brianwarnock

Retired
Local time
Today, 07:17
Joined
Jun 2, 2003
Messages
12,701
It seems odd that you are omitting the first of the month.

Brian
 

Users who are viewing this thread

Top Bottom