Link to home
Start Free TrialLog in
Avatar of Sandra Smith
Sandra SmithFlag for United States of America

asked on

Loop and build Message for USer in Access 2003

Users in our database have only calendar days in which to entered data.  I need to have a process that loops through the table and for each day four to seven days past today, create a message that informs the user which days are missing.  I want to build one message but am not sure how to join the loops

Sandra

Private Sub CheckforDataEntry(strUserID As String)
'Checks to see if the user has inputted data for days older than four from today
Dim intCount As Integer
Dim strMessage As String
Dim i As Integer

For i = 4 To 7
intCount = DCount("TaskDate", "tblCompletedTask", "UserID = '" & gstrUserID & "' AND TaskDate = Date() - " & i)

    If intCount = 0 Then
        'Do nothing
    Else
        strMessage = "You have no entries for the date: " & Date - i & " & vbCrLf"
       
    End If
   
Next i


End Sub
ASKER CERTIFIED SOLUTION
Avatar of mbizup
mbizup
Flag of Kazakhstan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Sandra Smith

ASKER

That was it.  I was initizlaing th variable strMessage in the wrong place.  Thank you.

Sandra