Results 1 to 8 of 8

Thread: Combo Box

  1. #1
    Join Date
    Jun 2002
    Location
    Kansas City
    Posts
    103

    Unanswered: Combo Box

    I have a combo box on a form with one item in the pull-down (at times). How can I force that item to display in the field without having to touch the pull-down using code?

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by JamesB
    I have a combo box on a form with one item in the pull-down (at times). How can I force that item to display in the field without having to touch the pull-down using code?
    At what point???

    To default the combobox to the 1st item is like:

    Mycombobox.value=mycombobox.column(mycombobox.Boun dColumn,0)
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Jun 2004
    Location
    Seattle, WA
    Posts
    601
    open up the properties window for the combo. On the data tab there should be a field name default value (? something along there) and just put whatever you want there in quotes and your combo is auto filled with whatever you type
    Ryan
    My Blog

  4. #4
    Join Date
    Jun 2002
    Location
    Kansas City
    Posts
    103
    Hi M Owen, and thanks for the reply. I tried your suggestion but didn't get the desired effect on this end. I have..........

    Me.Emp_Name.Value = Me.Emp_Name.Column(Me.Emp_Name.BoundColumn, 0)

    The control is a combo box and the row source is a query which returns a single, but different record each time. The control source is blank and the bound column = 1.

    Again, I'm trying to force the single record on the drop down to display in the field without the user having to touch it.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Make sure you're pulling the value you think you are:

    MsgBox Me.Emp_Name.Column(Me.Emp_Name.BoundColumn, 0)

    Also, what event are you placing this code in?

    And what do you mean by "the control source is blank"? That tells me the combobox has ZERO records. Therefore referencing the first record in the combobox is pointless... ?
    oh yeah... documentation... I have heard of that.

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

  6. #6
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Quote Originally Posted by JamesB
    Hi M Owen, and thanks for the reply. I tried your suggestion but didn't get the desired effect on this end. I have..........

    Me.Emp_Name.Value = Me.Emp_Name.Column(Me.Emp_Name.BoundColumn, 0)

    The control is a combo box and the row source is a query which returns a single, but different record each time. The control source is blank and the bound column = 1.

    Again, I'm trying to force the single record on the drop down to display in the field without the user having to touch it.
    Again ... I come back to this: At what point are you trying to do this? Also, where are you doing this?

    Since your bound column is 1 just do:
    Mycombobox.value=mycombobox.column(1,0)

    Now, you gotta pick the right spot to do it ...
    Back to Access ... ADO is not the way to go for speed ...

  7. #7
    Join Date
    Jun 2002
    Location
    Kansas City
    Posts
    103
    This code is running for control B 'On Exit' of control A. When I click on the drop down, I can see the value but it's still not being forced. I made the change to the following........Me.Emp_Name.Value = Me.Emp_Name.Column(1, 0)

    This seems like the logical place for the code?

  8. #8
    Join Date
    Sep 2003
    Posts
    228
    Quote Originally Posted by M Owen
    At what point???

    To default the combobox to the 1st item is like:

    Mycombobox.value=mycombobox.column(mycombobox.Boun dColumn,0)
    What property could I use to set the combo box value to be the last item in the list?

Posting Permissions

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