We help IT Professionals succeed at work.

modify a vb6 project

isnoend2001
isnoend2001 asked
on
52 Views
Last Modified: 2015-10-14
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
Comment
Watch Question

Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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?

Author

Commented:
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 LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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?

Author

Commented:
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 LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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?

Author

Commented:
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
Social distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks Marty
It will take me some time to look it over, i notice you are basing the time calculation on seconds.
Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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.

Author

Commented:
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
Martin LissSocial distance - Don't touch your face - Wash your hands for 20 seconds
CERTIFIED EXPERT
Most Valuable Expert 2017
Distinguished Expert 2018

Commented:
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.
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.