Working with datepicker values vb6

i am trying to this, but it does not work
If mydate > Now Then'this does not work
'start tomorrow
'MsgBox "Notifactions will start tomorrow," WeekdayName & Format(DTPicker1.Value, "HH:MM AM/PM") & " and continue everyday"
'Else
'start today
MsgBox "Reminder will notify at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " Today and continue everyday" '12 hr time"
End If
the date picker value to test with
Debug.Print DTPicker1.Value produces this: 10/3/2015 7:00:00 PM
isnoend2001Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Martin LissOlder than dirtCommented:
I don't know what you have in mydate, but if I set it to Now - 1 or Now + 1 it worked (with the changes below).
If mydate > Now Then
    'start tomorrow
    MsgBox "Notifications will start tomorrow, " & Format(DateAdd("d", 1, Now), "dddd") & ", at " _
          & Format(DTPicker1.Value, "HH:MM AM/PM") & " and will continue everyday"
Else
    'start today
    MsgBox "Reminder will appear at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " today and will continue everyday" '12 hr time"
End If

Open in new window

isnoend2001Author Commented:
Debug.Print DTPicker1.Value produces this: 10/3/2015 7:00:00 PM
mydate = DTPicker1.Value
i willtest your code
isnoend2001Author Commented:
no matter what time i select it only does the else
MsgBox "Reminder will appear at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " today and will continue everyday" '12 hr time"
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

isnoend2001Author Commented:
example
time
Martin LissOlder than dirtCommented:
What is in mydate?
isnoend2001Author Commented:
Private Sub Command_Click()
Dim mydate As Date
Martin LissOlder than dirtCommented:
I meant - what is the value when the code runs?
isnoend2001Author Commented:
here is everything
Private Sub Command_Click()
Dim mydate As Date
Dim myDay As Integer
'  Dim fName As String
   mydate = DTPicker1.Value
    If mydate > Now Then
    'start tomorrow
    MsgBox "Notifications will start tomorrow, " & Format(DateAdd("d", 1, Now), "dddd") & ", at " _
          & Format(DTPicker1.Value, "HH:MM AM/PM") & " and will continue everyday"
Else
    'start today
    MsgBox "Reminder will appear at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " today and will continue everyday" '12 hr time"
End If
also
   the tomorrow date need to add 1 day to the date
isnoend2001Author Commented:
datepicker
Martin LissOlder than dirtCommented:
Did you actually choose 10/17? I did and it works for me with this code (you don't need mydate; you can always use the vales of controls directly).

Private Sub Command1_Click()

If DTPicker1.Value > Now Then
    'start tomorrow
    MsgBox "Notifications will start tomorrow, " & Format(DateAdd("d", 1, Now), "dddd") & ", at " _
          & Format(DTPicker1.Value, "HH:MM AM/PM") & " and will continue everyday"
Else
    'start today
    MsgBox "Reminder will appear at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " today and will continue everyday" '12 hr time"
End If
End Sub

Open in new window

However if you choose a date after tomorrow, the message will still say "tomorrow". what do you want it to say?
Martin LissOlder than dirtCommented:
Oh I see! You have time in the datepicker. Let me try that and see what I can do.
isnoend2001Author Commented:
ok
Martin LissOlder than dirtCommented:
This works but there's a problem I think.
Private Sub Command1_Click()

If DateDiff("h", DTPicker1.Value, Now) > 1 Then
    'start tomorrow
    MsgBox "Notifications will start tomorrow, " & Format(DateAdd("d", 1, Now), "dddd") & ", at " _
          & Format(DTPicker1.Value, "HH:MM AM/PM") & " and will continue everyday"
Else
    'start today
    MsgBox "Reminder will appear at " & Format(DTPicker1.Value, "HH:MM AM/PM") & " today and will continue everyday" '12 hr time"
End If
End Sub

Open in new window

The problem is this. Let's say it's 7:19 PM here (which it is) if I use the up button on the dtpicker to get to, say, 10PM I get the "tomorrow" message. If however I use the down button until it shows 10PM I get the "today" message.
isnoend2001Author Commented:
yes there is something wrong
time now 7:52
datepicker time 10:00pm
message says tomorrow, but it should say today
Martin LissOlder than dirtCommented:
As I said, you can get to 10PM by going up or down. If you sister chooses 10PM, no matter which way she gets there, do you always want to say "tomorrow"?
Martin LissOlder than dirtCommented:
If so change the first line to

If Format(DTPicker1.Value, "HH:MM") > Format(Now, "HH:MM") Then

Open in new window


Note: Don't add the "AM/PM" to that line.
isnoend2001Author Commented:
No if the datepicker time is later than the pc time the it should say today
Martin LissOlder than dirtCommented:
Then change the > to a <.
isnoend2001Author Commented:
something is wrong
datepicker
Martin LissOlder than dirtCommented:
With this code
codewhere the dtpicker time is less than the PC time (10:19 PM) I get this
tomorrowand when the dtpicker time is greater I get this
 today
isnoend2001Author Commented:
Yes it's backwards
Martin LissOlder than dirtCommented:
Then change the first line of code. Mine shows a "<" (less than) so if it's backward make it a greater than ">"

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
isnoend2001Author Commented:
Could you post the code instead of a image of the code ?
isnoend2001Author Commented:
Thanks marty got it, never  relized dates/times was so difficult
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.