We help IT Professionals succeed at work.

DTPicker VB6 date value

Aquarus
Aquarus asked
on
3,353 Views
Last Modified: 2012-06-27
I am using DTPicker in my VB6 code. Whenthe form opens the first time the DTPicker.Value = Now().  And that is exactly what I see  -in a mm/dd/yyyy format.  I am using the calendar of the DTPicker to select the date in the future and save the record.  After the save process created the new record in the table I perform the "Populate date" funcution that repopulates-refreshes the form and set  DTPicker.Value = Now() again.  But that does not change anything.  The date I see is the last from the previous process.

Any suggestions?
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:
Can you show your code please?

Author

Commented:
This is the last of my try in the struggle.

    dtpSendOn.MinDate = DateAdd("d", 0, Now())
    dtpSendOn.MaxDate = DateAdd("d", 90, Now())
   
    Me.dtpSendOn.Value = Now()

Author

Commented:
And the property DataSource is set to Now(), but it was not before, at the time I have noticed that issue.  Thank you.
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'm a little confused. Are you saying that after you do Me.dtpSendOn.Value = Now() that you are expecting it to show a future date?

Author

Commented:
Sorry for the confusion.  Here isthe complete subroutine calls set under the event:

Private Sub cmdSave_Click()
  Save (suubroutine)
  SetUpRoutineButtons (another subroutine)
 
    optSendImmediately.Value = vbChecked
 
    dtpSendOn.MinDate = DateAdd("d", 0, Now())
    dtpSendOn.MaxDate = DateAdd("d", 90, Now())
   
    Me.dtpSendOn.Value = Now()
       
End Sub

When the cmsSave_Click event is fired on - the date in the datepicker usually some date in the future, like 04/02/2012.  And this part works correctly.

At the end of the event I need the dtpSendOn.Value  = Now() again as it was at the Form_Load event when it was set  Me.dtpSendOn.Value = Now()

And that is what does not work.  The datepicker keeps on displaying 04/02/2012, insted of 02/15/2012.

And I am confused myself...
Top Expert 2012
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
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
Top Expert 2012

Commented:
Are you sure this piece of code ever executes?
dtpSendOn.MinDate = DateAdd("d", 0, Now())
dtpSendOn.MaxDate = DateAdd("d", 90, Now())
   
Me.dtpSendOn.Value = Now()

Author

Commented:
Both suggestions were helpful, because I strated to doubt myself on my undesrtanding of what DTPicker.Value is actually means. What is displayed of internal value.  I'll continue my reasearch.

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
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.