Reminder Problem

  • Thread starter Thread starter Kay
  • Start date Start date
K

Kay

Hi

I have created a reminder for my project, I gave created an alarm table
with the fileds Alram Date, alarm time and alarm message. I have used
the following code in the on timer event() which checks the table to
see if any alarm times match the current time so it can set it off.
I am getting a compile error - "Next without For" and the code "Next i"
is highlighted. my code is as follows

Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim i As Integer

Set db = CurrentDb
Set rst = db.OpenRecordset("Select * AlarmTable Where Reset = False",
dbOpenSnapshot)
rst.MoveLast
rst.MoveFirst

For i = 1 To rst.RecordCount
If Me.[AlarmDate] = Date And Me.[AlarmTime] <= Time() And Me.[Reset] =
False Then
MsgBox ("A Job is Due") & vbCrLf & _
("ALARM ID = ") & AlarmID & vbCrLf & ("ALARM MESSAGE = ") &
AlarmMessage & vbCrLf & ("Please tick the reset box on the alarm form
to reset the alarm")

Next i

Can anyone please help

Very much appreciated
 
Your issue is not the For NExt loop.
Instead, it is the IF statement.

You need to close it with END IF, before the NEXT i line

:-)

Danny
 
Back
Top