Hi, I'm making a database in access where the number of minutes a resident has kept something is recorded in through a query. What i need to make is a msgbox notification that checks if there are any entries where the minutes is equal to a certain number of minutes, and then displays the name of the entry with the overdue item in the msgbox, ie "the resident: John Smith has items overdue". in addition the function has to run in the background, and automatically checks for overdue items.
i tried doing this by making a query that extracts entries with minutes = x (it can't be > x as i only want the msgbox to appear when its overdue by that number of minutes), and i even managed to get it to display the name of the resident in the msgbox, but then i ran into a problem: most of the time the query will be empty, where there are no items overdue, and then it comes up with an error saying, no record found. can anyone help me to make a statement that only executes when there is an entry in that query?
heres my code so far:
Private Sub Form_Load()
Me.TimerInterval = 10000
End Sub
Private Sub Form_Timer()
Dim rsVacs
Dim strEmplName As String
Set rsVacs = CurrentDb.OpenRecordset("VacQ2")
strEmplName = rsVacs.Fields("Resident_Name").Value
(this is the bit i can't figure out
) If strEmplName in VacQ2 is not empty Then
MsgBox "The following resident:, " & strEmplName & " has not returned the vacuum cleaner in more than one hour."
End If
End Sub
Please help me, i've searched all over this forum and found nothing relevant! Thanks in advance....
i tried doing this by making a query that extracts entries with minutes = x (it can't be > x as i only want the msgbox to appear when its overdue by that number of minutes), and i even managed to get it to display the name of the resident in the msgbox, but then i ran into a problem: most of the time the query will be empty, where there are no items overdue, and then it comes up with an error saying, no record found. can anyone help me to make a statement that only executes when there is an entry in that query?
heres my code so far:
Private Sub Form_Load()
Me.TimerInterval = 10000
End Sub
Private Sub Form_Timer()
Dim rsVacs
Dim strEmplName As String
Set rsVacs = CurrentDb.OpenRecordset("VacQ2")
strEmplName = rsVacs.Fields("Resident_Name").Value
(this is the bit i can't figure out
MsgBox "The following resident:, " & strEmplName & " has not returned the vacuum cleaner in more than one hour."
End If
End Sub
Please help me, i've searched all over this forum and found nothing relevant! Thanks in advance....