1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Date control in word 2010

Discussion in 'Business Applications' started by lorrdwolf, Nov 15, 2011.

Thread Status:
Not open for further replies.
  1. lorrdwolf

    lorrdwolf Thread Starter

    Joined:
    Nov 15, 2011
    Messages:
    1
    I am having trouble getting my date control to work properly. I am using Word 2010. I have added a reference to Microsoft Windows Common Controls-2 6.0 (SP6), I have added the date picker control to my tool box. I have added the date controls to my form and I named my date controls dtDate1 & dtDate2. My code is this:

    Code:
    Dim datDate1 as Date, datDate2 as Date
    datDate1 = dtDate1
    datDate2 = dtDate2
    Msgbox = "Date 1 is " & datDate1
    Msgbox = "Date 2 is " & datDate2
    
    When I run this and enter the appropriate dates into the form, I get "Date 1 is 12:00:00 AM" and "Date 2 is 12:00:00 AM". I do not get dates, I get times. Both controls are set to the format dtpShortDate.

    I also tried

    Code:
    Dim datDate1 as Date, datDate2 as Date
    datDate1 = CDate(dtDate1)
    datDate2 = CDate(dtDate2)
    Msgbox = "Date 1 is " & datDate1
    Msgbox = "Date 2 is " & datDate2
    
    with the same result.
    I need to grab the dates and manipulate them elsewhere in the code. Please, any help would be greatly appreciated.

    Thank you.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1027003

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice