Results 1 to 5 of 5
  1. #1
    Join Date
    Oct 2005
    Posts
    55

    Unanswered: using a Combo box

    Hello

    So here is what I want to do!

    I want to use a combo box that will list the years calender. for example 01-Jan-06 to 31-Dec-06 how do I go about doing this.

    Any help I will be thankful for because I do not know how to start.

  2. #2
    Join Date
    Feb 2004
    Location
    Chicago, IL
    Posts
    1,312
    I can't think of any slick way to do it. I think you are going to have to build a table with all of the days you want.

    Is there another way to accomplish what you want?

  3. #3
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Rather simple: You konw that there will always be Jan 1 20XX and Dec 31 20XX ... Perhaps a loop using the DateAdd function ... Start with Jan 1 and add 1 day until reaching Dec 31.

    Is this what you're looking for?
    Back to Access ... ADO is not the way to go for speed ...

  4. #4
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    frankly, it is an insane thing to want to do.
    autocomplete works the wrong way.
    anyhow, it is easily done.

    add a combo "myCombo" to your form
    in the Form_Load() event, use

    dim myValueList as string
    dim i as integer
    dim dblX as double
    const seedDate as date = #1/1/2006#
    dblX = seedDate
    myValueList = format(dblX, "dd-mmm-yyyy") & ", "
    dblX = dblX + 1 ' - ooooops! forgot that bit
    for i = 1 to 365
    myValueList = myValueList & format(dblX, "dd-mmm-yyyy") & ", "
    dblX = dblX + 1
    next
    me.myCombo.rowsource = myValueList

    izy

    LATER STILL:

    Lets get it right:

    dim myValueList as string
    dim i as integer
    dim dblX as double
    const seedDate as date = #1/1/2006#
    dblX = seedDate
    for i = 1 to 365
    myValueList = myValueList & format(dblX, "dd-mmm-yyyy") & ", "
    dblX = dblX + 1
    next
    myValueList = left$(myValueList, len(myValueList)-1)
    me.myCombo.rowsource = myValueList


    ...and don't forget the RowSourceType: Value list
    Last edited by izyrider; 08-08-06 at 15:00.
    currently using SS 2008R2

  5. #5
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    How about getting a pre-fab calendar control (a couple have been posted in this forum and google will give you a bunch)?

    tc

Posting Permissions

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