Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2005
    Posts
    313

    Unanswered: dropdown list, select the currect year.

    Hi,

    I created one combox on the form.

    Then,
    I made that
    Me.test.RowSource = "2003;2004;2005;2006;2007;2008"

    Suppose the combox is empty/Null.
    If I click the combox, it will show all choices.
    Then I select one value.

    But, I want the highlight is go to 2005 immediately once I click the box. Just hightlight, not choose yet. Because everytime it start from beginning 2003, it so trouble.

    I cannot find which command is fixed to this problem.
    Does anybody know it? Thanks.

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Well let's see...

    You want to set the default value for the combobox... maybe you should try the "Default Value" property...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Sep 2005
    Posts
    313
    Default value is set the value into the box.

    No. I mean the default highlight is on currect year, when I click the combox.

    for example:

    there are 2001;2002;2003;2004;2005;2006;2007;2008.

    When I click the combox, it will show the dropdown list with these values:
    2001;2002;2003;2004;2005;2006;2007;2008,

    but, I want the box's highlight is on currect year, 2005.

    Because, everytime when I click that, it will show 2001 first, I want the first one to be 2005 (it depends on the currect year), if I click the combox on 2006, then it will show 2006 first.

    Not default value.

    Thanks.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    me.value=year(now())

  5. #5
    Join Date
    Sep 2005
    Posts
    313
    no, it doesn't work.

    RecordSource: 2001,2002,2003,2004,2005,2006,2007,2008

    when I click the combox, it list these value:
    2001
    2002
    2003
    2004
    2005
    2006
    2007
    2008
    2009
    ...etc

    I want to set the first choice to be 2005 (it will check currect year).
    like that: (2001-2004) skip to look.
    2005
    2006
    2007
    2008
    ...etc..

    Because it is more faster to reach.

    Thanks.

  6. #6
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    What doens't work?

    if you set a value of the combobox thats the currentvalue

    maybe you should try
    <mycombobox>.value=year(now())

  7. #7
    Join Date
    Sep 2005
    Posts
    313
    yes, it come out the value, 2005.

    But, I just highlight on 2005 on the list.

    Because when I click the combox, then the value come out on the combox.

    I just want to set the first choice to be 2005 on the list. The combox is still empty/null until I click the value of the list.

    Thanks.

  8. #8
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    well in that event you are going to have to write a function which populates the conbo with the current year
    so investigate the help system on combo boxes
    find out which of the 3 record source types allow you to specify values
    add your values to the the relevant data storage collection in the sequence you prefer
    use some of the code already available to you in this thread.
    you could, of course always make it static, ie set it at design time, but then it will blow up in around 15 days from today, or conversely, not work for the next 15 days, nas then blow up 365 days later.

    where you place the code is up to you

Posting Permissions

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