D
dgodfrey
I have a checkbox on my form called ActiveCheck that I want to be checked if
the information has not expired. I have a textbox with a short date that is
an expiration date for the record.
What I want is for the database to compare the current date to the
expiration date and uncheck the checkbox once the expiration date has passed.
I want the initial state of the checkbox to be unchecked and when a new
record is added, that record automatically checks the checkbox.
The purpose of this is a quick visual indicator of which records are active
and which or not when we do a search.
Alternatively, I could have a checkbox called "Expired" that would be
checked when the expiration date passes, and be unchecked otherwise. Either
would work.
***The real trick is, we are going to have some that will never expire, and
I have yet to figure out how to make that work. I had thought about doing a
never/ X# of years type of thing, but that doesn't seem to plausible. I
really need to take this into consideration with this checkbox thing. I am
even open to an entirely different method of flagging active/unexpired and
Inactive/Expired records...just as long as it is obvious to any user the
status of the record, no matter how they find it (search, query, report,
form, etc.) Any suggestions are much appreciated.
I have tried using Date() and Now in my conditional statement and I keep
getting an "Else with no If" error message:
Private Sub Expires_AfterUpdate()
If Me.Expires < Now Then Me.ActiveCheck = True
Else
Me.ActiveCheck = False
End If
End Sub
It is probably something simple I am missing.
Thanks,
Derek
the information has not expired. I have a textbox with a short date that is
an expiration date for the record.
What I want is for the database to compare the current date to the
expiration date and uncheck the checkbox once the expiration date has passed.
I want the initial state of the checkbox to be unchecked and when a new
record is added, that record automatically checks the checkbox.
The purpose of this is a quick visual indicator of which records are active
and which or not when we do a search.
Alternatively, I could have a checkbox called "Expired" that would be
checked when the expiration date passes, and be unchecked otherwise. Either
would work.
***The real trick is, we are going to have some that will never expire, and
I have yet to figure out how to make that work. I had thought about doing a
never/ X# of years type of thing, but that doesn't seem to plausible. I
really need to take this into consideration with this checkbox thing. I am
even open to an entirely different method of flagging active/unexpired and
Inactive/Expired records...just as long as it is obvious to any user the
status of the record, no matter how they find it (search, query, report,
form, etc.) Any suggestions are much appreciated.
I have tried using Date() and Now in my conditional statement and I keep
getting an "Else with no If" error message:
Private Sub Expires_AfterUpdate()
If Me.Expires < Now Then Me.ActiveCheck = True
Else
Me.ActiveCheck = False
End If
End Sub
It is probably something simple I am missing.
Thanks,
Derek