OnLoad Event with 4 queries...

J

JL

Basically I wrote 4 queries for each certificate so I could tell which
certificate was "past due". Where I'm having the most problem is
getting these queries to initiate in my "Start up" form. I hate to post
this again but for some reason I just can't figure this one out... In
my previous post someone mentioned doing a dlookup to reference each
field I want to reference. I am not real familiar with dlookups. So I
tried going my own route and that's not working either! I need somehow
to get ALL 4 fields that hold the 4 different dates to initiate here
along with the queries- *I think*. Here is what I tried:

Private Sub Form_Load()
Dim I As Integer
Dim IntTotal As Integer
Dim intStore As Integer
For I = 1 To 4
intStore = DCount("[No_Certs]", "[tblEmpsTraining]", "[DOC_CPR]<=
" & DateAdd("yyyy", -I,[DOC_CPR]) & " AND [TypeOfTraining] = " & i &
")"
If intStore > 0 Then
MsgBox "There are " & intStore & " certificates greater than "
& I & " years old" IntTotal = IntTotal + intStore
End If
Next I
If MsgBox("There Are " & IntTotal & " Certificiates Past Due Today." &
_ vbCrLf & vbCrLf & "Would you like to see these now?" _
, vbQuestion + vbYesNo, "Past Due Certificates To Review...
") = vbYes Then DoCmd.OpenForm "frmCertificates", acNormal
Else DoCmd.Close acForm, Me.Name End IfEnd Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top