+ Reply to Thread
Results 1 to 4 of 4

Chnage format of Date in Listbox

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Chnage format of Date in Listbox

    Hi All
    The following code populate listbox but the date appears in wrong format(mm/dd/yyyy). It should be in dd/mm/yyyy format. Can anyone please modify the code accordingly.
    strsql = "select count(*) as [Total Letters],username,Date1 from tblmaster where Date1 >= #" & Format(DateSerial(ComboBox3, ComboBox2, ComboBox1), "mm/dd/yyyy") & "# and date1 <= #" & Format(DateSerial(ComboBox6, ComboBox5, ComboBox4), "mm/dd/yyyy") & "# group by Date1,username"
    rs.Open strsql, cn
    ListBox1.Column = rs.GetRows
    rs.Close

  2. #2
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Chnage format of Date in Listbox

    Use:
    strsql = "select count(*) as [Total Letters],username,Format (Date1, 'dd/mm/yyyy') from tblmaster where Date1 >= #" & Format(DateSerial(ComboBox3, ComboBox2, ComboBox1), 'dd/mm/yyyy') & "# and date1 <= #" & Format(DateSerial(ComboBox6, ComboBox5, ComboBox4), 'dd/mm/yyyy') & "# group by Date1,username"
    Last edited by Kelshaer; 01-30-2012 at 10:00 AM.
    Regards,
    Khaled Elshaer
    www.BIMcentre.com

    Remember To Do the Following....
    1. Thank those who have helped you by clicking the Star below their post.
    2. Mark your post SOLVED if it has been answered satisfactorily:
    • Select Thread Tools (on top of your 1st post)
    • Select Mark this thread as Solved

  3. #3
    Forum Contributor
    Join Date
    02-20-2009
    Location
    bristol
    MS-Off Ver
    Excel 2003
    Posts
    882

    Re: Chnage format of Date in Listbox

    Thanks a lot for your help. It worked like a charm

  4. #4
    Valued Forum Contributor
    Join Date
    08-29-2011
    Location
    Mississauga, CANADA
    MS-Off Ver
    Excel 2010
    Posts
    503

    Re: Chnage format of Date in Listbox

    Please Mark The Thread as SOLVED

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1