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
 

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

Code error 4
Alarm Code error 3
Problem with code 10
Reminder Problem 3
Alarm message 7
Alarm form 6
Do/Loop Dilemma 6
Run-Time Error 2501 The OpenForm action was cancelled 1

Back
Top