Avatar of isnoend2001
isnoend2001
Flag for United States of America asked on

modify a vb6 project

Need modification to this code (see below code)
Private Sub TimeCheck()
Dim TimeDifference As String
'dim TimeNow as ?
Dim TaskTime As String
Dim dteTaskTime As Date

' I assume that this is defined someplace else so it's
' not needed here
Dim gintDailyReminder As Integer

' I assume that TaskTime is the time at which she needs
' to take her medicine
TaskTime = 900  '9AM
dteTaskTime = Left$(TaskTime, Len(TaskTime) - 2) & ":" & Right$(TaskTime, 2)

' I assume that gintDailyReminder is the number of hours before
' the task time that she should get the first message
gintDailyReminder = 2 'from ini file(Hours)

' What is megintDailyReminder? Did you mean gintDailyReminder?
'TaskTime = TaskTime - megintDailyReminder


TimeDifference = Format(Time() - dteTaskTime, "HH:NN") 'gintDailyReminder
Select Case CInt(Left$(TimeDifference, 2)) - gintDailyReminder
Case Is > 2
    Exit Sub
Case 0
  MsgBox "You need to take your medicine in 2 hours at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/PM
Case -1
  MsgBox "You need to take your medicine in 1 hour at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/PM
Case Else
  MsgBox "You Forgot to take your medicine at " & Format(dteTaskTime, "HH:NN AM/PM") 'convert to AM/P
End Select
End Sub

Open in new window


gintDailyReminder may not apply it may be zero then
Case ?
Msgbox "It's time to take your medicine"'no reminder
also need a way to stop the messages when the task is done for each day
I will post the question
is there any way to give bonus points ?
__Time-.zip
Visual Basic Classic

Avatar of undefined
Last Comment
Martin Liss

8/22/2022 - Mon
Martin Liss

There's no way to give bonus points. The best you can do is to give an "A" grade but that's what's normally done anyhow.

Would a grid or other control on the form where the tasks for the day were listed and a checkbox next to each one that indicates competition be acceptable?
isnoend2001

ASKER
Would a grid or other control on the form where the tasks for the day were listed and a checkbox next to each one that indicates competition be acceptable?
Have to give this more thought. what would the checkbox do?
more concerned with
 gintDailyReminder may not apply it may be zero then
Case ?
Msgbox "It's time to take your medicine"'
also need a way to stop the messages when the task is done for each day
Martin Liss

The column above the reminders would say "Today's Reminders" and the heading above the checkboxes would say "Done" and helpText for it would say "If you've followed up on the reminder, check the box".  

In any case if the box were checked the 1 hour, two hour and/or whatever other warnings were associated with the event could be stopped.

If gintDailyReminder is 0, what do you want to have happen?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
isnoend2001

ASKER
If gintDailyReminder is 0, what do you want to have happen?
Msgbox "Its time to take your medicine"
There are reminders, and a past due  but missing is
 at the time is is scheduled
there is a reminder 2 hours before and 1 hour before,but nothing at the time it is due.
Are you referring to a msflexgrid?
with each row or rows if more than one scheduled task(s) ?
Martin Liss

Yes I'm referring to an msflexgrid and there would be one row for each task that was due to happen today.

I just thought of something. We've been talking about a file called dy0900.rtf and reminders that say "It's time to take your medicine"'. Surely all the reminders can't be about medicine can they? If not then where are the descriptions of the tasks stored?
isnoend2001

ASKER
Actually The reminder i have made for yearly actually opens the rtf and
the reminders say "You have a task due in 2 days" etc and a labellabel
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
Martin Liss

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
isnoend2001

ASKER
Thanks Marty
It will take me some time to look it over, i notice you are basing the time calculation on seconds.
Martin Liss

i notice you are basing the time calculation on seconds.
Yes, that's the only way I could think of to prevent a 2-hour or 1-hour reminder msgbox from appearing every 10 seconds.

BTW you should delete line 24.
isnoend2001

ASKER
Really got a curve thrown to me of coding this
Went wit my sister to the doc today and he prescribed medicine for her to take before bed time.
so now she needs a reminder in the am and pm
All of life is about relationships, and EE has made a viirtual community a real community. It lifts everyone's boat
William Peck
Martin Liss

Here are some rtf name suggestions
 ap0800_2000 ' ap = AM & PM
dy2_0800_2000
2d0800-2000

or if the second dose is always 12 hours later you don't need the _2000 part.