Reminder Problem

K

Kay

Hi
I have created a reminder in my database. I have created a reminder
table with the fields alarm id, alarm date, alarm time and alarm
message. I use a form to enter the alarm details into my table. I have
used the following code in my form timer event:

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")


If the alarm time is passed, the alarm message is shown after every
update so I have used a reset checkbox to stop an alarm that already
has
gone off. The problem I have is that a message is only shown for an
alarm that the focus is set on. By that I mean If alarm id 123 is
displayed in the form, then the alarm message will only be shown for
that alarm when the time has come. What I need it to do is to shown
the message for any alarm not just the one that is being viewed.

Any help will be much appreciated
 
K

Keith Wilby

Kay said:
Hi
I have created a reminder in my database. I have created a reminder
table with the fields alarm id, alarm date, alarm time and alarm
message. I use a form to enter the alarm details into my table. I have
used the following code in my form timer event:

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")


If the alarm time is passed, the alarm message is shown after every
update so I have used a reset checkbox to stop an alarm that already
has
gone off. The problem I have is that a message is only shown for an
alarm that the focus is set on. By that I mean If alarm id 123 is
displayed in the form, then the alarm message will only be shown for
that alarm when the time has come. What I need it to do is to shown
the message for any alarm not just the one that is being viewed.

Any help will be much appreciated

I think you'd need to open a recordset in code and loop through/test each
record with the criteria you currently use in your form's timer event.

(Untested air code)

Dim rs As Recordset
set rs = me.RecordsetClone
With rs
Do Until .EOF
.MoveFirst
If ![AlarmDate] = Date And ![AlarmTime] <= Time() And ![Reset] =
False Then
MsgBox ...
.MoveNext
Loop
End With
set rs = nothing

If there are a lot of overdue items then I'm not so sure it would be
practical to have those message boxes rattling off like that ... perhaps
display the offending record details in a dialogue box instead.

Keith.
www.keithwilby.com
 
K

Kay

Hi

I tried this code but it comes up with the error msg - 'loop without
do' and it highlights the word loop in the following

..MoveNext
Loop
End With

Any ideas
 
K

Keith Wilby

Kay said:
Hi

I tried this code but it comes up with the error msg - 'loop without
do' and it highlights the word loop in the following

.MoveNext
Loop
End With

Any ideas

Well I did say it was untested ;-)

Without coding it myself I'm not entirely sure but try moving the loop
command ... I think the MoveFirst should be before the Do Until too ... if I
get chance I'll try to code it properly but just try experimenting and also
try running it in step mode so you can see which line is executing and when.

Regards,
Keith.
 

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

Alarm message 7
Problem with code 10
Alarm Code error 3
Alarm form 6
Reminder Problem 1
Alarm in access 1
Code error 4
Outlook email -- A program is trying to automatically send e-mail onyour behalf . . . 8

Top