Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

combo box questions

Discussion in 'Information Technology' started by dave, Nov 19, 2005.

  1. dave

    dave
    Expand Collapse
    Guest

    I have a combo box and i've got most of what i need for it all firgured out
    but i have two questions and any help with them would be greatly appreciated.

    1) i know to get the first value is [Combo19].[ItemData](0) is there
    something i could put in place of zero to get to the last item (other then
    the actual index to the item)?

    2) is there a setting or code i could use to prevent the user to be able to
    type in the combo box locking and\or disabling don't work beccause then i
    can't select things.
     
  2. Loading...


  3. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Fri, 18 Nov 2005 09:59:05 -0800, "dave"
    <dave@discussions.microsoft.com> wrote:

    >I have a combo box and i've got most of what i need for it all firgured out
    >but i have two questions and any help with them would be greatly appreciated.
    >
    >1) i know to get the first value is [Combo19].[ItemData](0) is there
    >something i could put in place of zero to get to the last item (other then
    >the actual index to the item)?


    Why would you WANT to do so? What's the rowsource; or is it variable?

    You could do it in code, I suspect (though I haven't tried it):

    [Combo19].[Itemdata].Column([Combo19].ColumnCount - 1)

    but I'm not sure I understand the scenario that would make this
    useful!

    >2) is there a setting or code i could use to prevent the user to be able to
    >type in the combo box locking and\or disabling don't work beccause then i
    >can't select things.


    Set its Limit to List property to True.

    John W. Vinson[MVP]
     
  4. dave

    dave
    Expand Collapse
    Guest

    well if you want to know i need the last entry because that is the latest one
    entered. when a subform that enters a new record closes i want the combo box
    to display that record so other data can be entered without having to select
    it. your suggestion should work i just have to fiddle with it i think.

    as for seting limit to list to true it is already set to yes. any other
    suggestions?

    "John Vinson" wrote:

    > On Fri, 18 Nov 2005 09:59:05 -0800, "dave"
    > <dave@discussions.microsoft.com> wrote:
    >
    > >I have a combo box and i've got most of what i need for it all firgured out
    > >but i have two questions and any help with them would be greatly appreciated.
    > >
    > >1) i know to get the first value is [Combo19].[ItemData](0) is there
    > >something i could put in place of zero to get to the last item (other then
    > >the actual index to the item)?

    >
    > Why would you WANT to do so? What's the rowsource; or is it variable?
    >
    > You could do it in code, I suspect (though I haven't tried it):
    >
    > [Combo19].[Itemdata].Column([Combo19].ColumnCount - 1)
    >
    > but I'm not sure I understand the scenario that would make this
    > useful!
    >
    > >2) is there a setting or code i could use to prevent the user to be able to
    > >type in the combo box locking and\or disabling don't work beccause then i
    > >can't select things.

    >
    > Set its Limit to List property to True.
    >
    > John W. Vinson[MVP]
    >
     
  5. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    Try using the KeyPress Event of the ComboBox and set the KeyAscii to 0.

    Check Access VB Help on the KeyPress Event.

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "dave" <dave@discussions.microsoft.com> wrote in message
    news:027DD024-D439-49AD-A9E1-449C98475955@microsoft.com...
    > well if you want to know i need the last entry because that is the latest
    > one
    > entered. when a subform that enters a new record closes i want the combo
    > box
    > to display that record so other data can be entered without having to
    > select
    > it. your suggestion should work i just have to fiddle with it i think.
    >
    > as for seting limit to list to true it is already set to yes. any other
    > suggestions?
    >
     
  6. John Vinson

    John Vinson
    Expand Collapse
    Guest

    On Fri, 18 Nov 2005 11:57:15 -0800, "dave"
    <dave@discussions.microsoft.com> wrote:

    >well if you want to know i need the last entry because that is the latest one
    >entered. when a subform that enters a new record closes i want the combo box
    >to display that record so other data can be entered without having to select
    >it. your suggestion should work i just have to fiddle with it i think.


    You were asking (I thought) for the last COLUMN in the combo box. Now
    I see you want the value of the table field to which this combo box is
    bound from the most recently entered record - a totally different
    issue.

    I think you may be misunderstanding the function of a combo box. It
    doesn't display "a record". It allows you to select ONE field from a
    query or list of values (its "Row Source") and (optionally) store that
    one value into a single field of some other table (its "Control
    Source").

    How are *you* using the combo box? What specifically are you trying to
    accomplish with it?

    John W. Vinson[MVP]
     
  7. dave

    dave
    Expand Collapse
    Guest

    it was KeyCode that needed to be set to 0 but thats ok. thanks for the help!

    "Van T. Dinh" wrote:

    > Try using the KeyPress Event of the ComboBox and set the KeyAscii to 0.
    >
    > Check Access VB Help on the KeyPress Event.
    >
    > --
    > HTH
    > Van T. Dinh
    > MVP (Access)
    >
    >
    >
    > "dave" <dave@discussions.microsoft.com> wrote in message
    > news:027DD024-D439-49AD-A9E1-449C98475955@microsoft.com...
    > > well if you want to know i need the last entry because that is the latest
    > > one
    > > entered. when a subform that enters a new record closes i want the combo
    > > box
    > > to display that record so other data can be entered without having to
    > > select
    > > it. your suggestion should work i just have to fiddle with it i think.
    > >
    > > as for seting limit to list to true it is already set to yes. any other
    > > suggestions?
    > >

    >
    >
    >
     
  8. Van T. Dinh

    Van T. Dinh
    Expand Collapse
    Guest

    That means you use the KeyDown Event which is fine also..

    KeyAscii is used with the KeyPress Event so my advice was correct.

    --
    HTH
    Van T. Dinh
    MVP (Access)



    "dave" <dave@discussions.microsoft.com> wrote in message
    news:1658A2ED-19D3-4C0D-9D0F-E36832229DB1@microsoft.com...
    > it was KeyCode that needed to be set to 0 but thats ok. thanks for the
    > help!
    >
     

Share This Page