I created this code to change some text on my form to indicate if the name record is a current card holder or not. It's overly complicated because all cards expire at the end of the year, but if they applied within the last two months of the year then we give them a card that will last until the end of next year.
After having made it though, I'm not sure what even to put it under!
Also, I'm not sure if the 12/31/[datepart("yyyy",now)] syntax is correct. My background has nothing to do with VB or Access if you couldn't tell...
Any help would be greatly appreciated!
After having made it though, I'm not sure what even to put it under!
Also, I'm not sure if the 12/31/[datepart("yyyy",now)] syntax is correct. My background has nothing to do with VB or Access if you couldn't tell...
Any help would be greatly appreciated!
Code:
Dim datecount As Integer 'assigned the # of days between issue date and end of year
Dim expirecount As Integer 'assigned the # of days before card expires
Dim issuedate As Date
issuedate = Me.frmNameSubApp.Form!appIssueDate
datecount = DateDiff("d", issuedate, 12 / 31 / [datepart("yyyy",now)])
If datecount < 60 And datecount > 0 Then
expirecount = 365 + datecount
Else
expirecount = 365 - DateDiff("d", Now, 12 / 31 / [datepart("yyyy",now)])
End If
If issuedate = Null Then
Text27.Text = Null
ElseIf DateDiff("d", issuedate, Now) >= expirecount Then
Text27.Text = "Current Card Holder"
Else
Text27.Text = "Not Current"
End If