Form events

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a form that pulls information from a query. I would like to know if it
is possible to set an event that would alert us to when their dates for
training are expired? Example: Joe Smith
SSN-1234567

Biology exam 1/30/07


Would I be able to make something where they click on the date and an alert
shows that they need to take a new test? If that's possible please explain it
as simple as possible because I am ok with Access, not a pro, don't know all
the terms. If I can't do that do you have any suggestions?
 
That's not really what Events are, or at least it's not the sort of events
that Forms support.

What you could do is have a button on the form that sets a filter limiting
what's displayed on the form to only those records within n days of their
expiration date.

You'd do this using something like:

Private Sub MyButton_Click()
Dim strFilter As String

strFilter = "ExpiryDate BETWEEN " & _
Format(DateAdd("d", -7, Date()), "\#mm\/dd\/yyyy\#") & _
" AND " & Format(Date(), "\#mm\/dd\/yyyy\#")
Me.Filter = strFilter
Me.FilterOn = True

End Sub
 
You can place code in the "OnCurrent" event of your form that will check the
value of the date and provide information to the user.

The code would be something like:

If Not IsNull(Me.NameOfDateField) then
If me.NameOfDateField < Date then
Msgbox "The Biology exam date is past due!"
End IF
End If

By using the acutual name of your Date control in place of the
"NameOfDateField" in both places above, every time a record is displayed in
your form, this code will check to see if the date in the Bilology Date field
is less than todays date. If it is, the message box will be displayed.

If there is no value in the Bilology Date field or the value in the Bilology
Date field is equal to or greater than todays date, then no message will be
presented.
 
Mr B, Yeah that sounds exactly like what I want.......I just have no idea how
to set that up. I am really a novice at this and I am setting a project up
can you please help with a easier explination, some kind of walk through if
you don't mind.
 
Back
Top