Consulting

Results 1 to 3 of 3

Thread: date problem on a form

  1. #1
    VBAX Tutor
    Joined
    Nov 2007
    Posts
    291
    Location

    date problem on a form

    Hello,

    I have a userform with two testboxes for start and end date and command buttons which open another userform which has a calendar control on it.

    When I do :-

    frmAddNew.Controls("txtStartDate").Value = CDate(Calendar1.Value)

    after choosing the 27th of August I get :-

    8/27/2010

    but when I do :-

    frmAddNew.Controls("txtStartDate").Text = CDate(Calendar1.Value)

    I get :-

    27/08/2010

    My system date is set to UK and I want :-

    27/08/2010

    I wan wondering why I cant use .Value


    Thanks
    Phil

  2. #2
    VBAX Guru Kenneth Hobs's Avatar
    Joined
    Nov 2005
    Location
    Tecumseh, OK
    Posts
    4,956
    Location
    Try the Format command?
    [VBA]frmAddNew.Controls("txtStartDate").Text = Format(CDate(Calendar1.Value),"mm/dd/yyyy")
    [/VBA]
    or some variation.

  3. #3
    VBAX Expert
    Joined
    Feb 2005
    Location
    Nanaimo, British Columbia, Cananda
    Posts
    568
    Location
    Excel dates...
    Cheers,

    dr

    "Questions, help and advice for free, small projects by donation. large projects by quote"

    http:\\www.ExcelVBA.joellerabu.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •