I am trying to design a birthday reminder pop up, but for having never done coding before it has proven quite challenging.
I am currently using this code but the reminder just keep poping up weither there is a birthday or not.
Probably a syntax error but cannot find it.
Any help will be appreciated.
Private Sub Form_Load()
Dim RCount
On Error GoTo Form_Load_Err
DoCmd.Restore
T = 0
RCount = DCount("*", "BirthDay_Reminder")
If RCount = 0 Then
'control is not passed into the Timer Event procedure
End If
If RCount > 0 Then
Me.TimerInterval = 250
End If
Form_Load_Exit:
Exit Sub
Form_Load_Err:
MsgBox Err.Description, , "Form_Load"
End Sub
Private Sub Form_Timer()
On Error GoTo Form_Timer_Err
T = T + 1
Select Case T
Case 20
REMPOPUP
Me.TimerInterval = 0
Case 260
REMPOPUP
Case 261
T = 21
End Select
Form_Timer_Exit:
Exit Sub
Form_Timer_Err:
MsgBox Err.Description, , "Form_Timer"
Resume Form_Timer_Exit
End Sub
Private Function REMPOPUP()
Dim strPath As String, i As Integer, mplayerc As String
Dim mplayer As String, soundC As String
On Error GoTo REMPOPUP_Err
mplayerc = "C:\Program Files\Windows Media Player\mplayer2.exe "
soundC = "C:\Windows\Media\notify.wav"
If Len(Dir(mplayerc)) > 0 Then
mplayer = mplayerc & soundC
Call Shell(mplayer, vbMinimizedNoFocus)
End If
strPath = "C:\Windows\Temp\BirthDay_Reminder.snp"
DoCmd.OutputTo acOutputReport, "BirthDay_Reminder", _
"SnapshotFormat(*.snp)", strPath, True, ""
DoCmd.OpenReport "BirthDay_Reminder", acViewREMPOPUP_Exit:
Exit Function
REMPOPUP_Err:
MsgBox Err.Description, , "REMPOPUP"
End Function