Welcome to SPN

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

Sign Up Now!

Auto open combo box options?

Discussion in 'Information Technology' started by nshippers, Jul 28, 2006.

  1. nshippers

    nshippers
    Expand Collapse
    Guest

    Our Access database is used for entering survey questionaire data. Many
    fields have combo boxes with several options.

    I would like the combo box look-up to open automatically when a person
    clicks or tabs over to a field box instead of having to press f4 as a
    shortcut.

    Any help would be appriciated!
     
  2. Loading...

    Similar Threads Forum Date
    Opinion Is Autocomplete Evil? Some Women Take A Hard Look at Google ! Breaking News Nov 7, 2013
    Sikh News AutoZone sued for firing Everett Sikh Breaking News Sep 29, 2010
    India Singh: Centre Ready To Give Kashmir Autonomy Breaking News Aug 11, 2010
    India Paste tariff cards behind driver’s seat: Transport dept to automen Breaking News Jul 21, 2010
    Gursharan Kaur: India's First Lady's Autobiography Sikh Personalities Jun 1, 2010

  3. Yanick

    Yanick
    Expand Collapse
    Guest

    Try Me.MyComboBox.Dropdown in either GotFocus Event or OnClick Event.

    Yanick

    "nshippers" wrote:

    > Our Access database is used for entering survey questionaire data. Many
    > fields have combo boxes with several options.
    >
    > I would like the combo box look-up to open automatically when a person
    > clicks or tabs over to a field box instead of having to press f4 as a
    > shortcut.
    >
    > Any help would be appriciated!
     
  4. nshippers

    nshippers
    Expand Collapse
    Guest

    Thank you, Yanick! Just for anyone else who may want to do this, I created
    the following code (S_Q1 is a field, or question 1):

    Private Sub S_Q1_GotFocus()
    Me.S_Q1.Dropdown
    End Sub

    Is there a way, do you think, to have one code for all combo boxes of a
    form? I tried to fiddle with some coding, but unable to make it work.

    "Yanick" wrote:

    > Try Me.MyComboBox.Dropdown in either GotFocus Event or OnClick Event.
    >
    > Yanick
    >
    > "nshippers" wrote:
    >
    > > Our Access database is used for entering survey questionaire data. Many
    > > fields have combo boxes with several options.
    > >
    > > I would like the combo box look-up to open automatically when a person
    > > clicks or tabs over to a field box instead of having to press f4 as a
    > > shortcut.
    > >
    > > Any help would be appriciated!
     
  5. Yanick

    Yanick
    Expand Collapse
    Guest

    Try something like this.

    Named all your combo box with the same name + a number : ex.:
    Combobox1,Combobox2,Combobox3 ...

    Then with a for...next, access the drop down propertie.

    Dim i as integer

    For i = 1 to 3
    Me("Combobox" & i).dropdown
    next i

    Yanick

    "nshippers" wrote:

    > Thank you, Yanick! Just for anyone else who may want to do this, I created
    > the following code (S_Q1 is a field, or question 1):
    >
    > Private Sub S_Q1_GotFocus()
    > Me.S_Q1.Dropdown
    > End Sub
    >
    > Is there a way, do you think, to have one code for all combo boxes of a
    > form? I tried to fiddle with some coding, but unable to make it work.
    >
    > "Yanick" wrote:
    >
    > > Try Me.MyComboBox.Dropdown in either GotFocus Event or OnClick Event.
    > >
    > > Yanick
    > >
    > > "nshippers" wrote:
    > >
    > > > Our Access database is used for entering survey questionaire data. Many
    > > > fields have combo boxes with several options.
    > > >
    > > > I would like the combo box look-up to open automatically when a person
    > > > clicks or tabs over to a field box instead of having to press f4 as a
    > > > shortcut.
    > > >
    > > > Any help would be appriciated!
     
  6. Peter Danes

    Peter Danes
    Expand Collapse
    Guest

    Sorry Yanick, I don't think that will work. (At least it doesn't in A2K, on
    my machine). For one thing, you need to SetFocus to a control before you can
    make it drop; for another, as soon as you SetFocus to another control, the
    previous one rolls up again.

    To nshippers, as far as I've been able to determine, what you want isn't
    possible. I wish it was, I use the drop-on-entry functionality a lot, it
    just makes sense to me to have a combobox drop open automatically in many
    situations, instead of waiting for the user to do it manually. I wish there
    was a DropOnEntry property for comboboxes that I could check yes or no,
    instead of always having to code it. But there doesn't seem to be any other
    way than by writing event code for each box. You could write a routine that
    contained the code Me.ActiveControl.DropDown, but you would still have to
    call that routine from each combobox's event code, which would actually be
    more work than simply putting the DropDown command directly in the event
    routine.

    And there are some issues with the ActiveControl method. I'm not sure
    exactly what the problem is, you could probably scan the archives to see
    what people have to say about it. I believe the major issue is that, in
    complicated routines, the active control may suddenly become something other
    than what you thought. I only use it in things like the OnEntry or GotFocus
    event routines, where I know for certain what the active control is, so I've
    never had any problems with it. You could code your drop command as
    ActiveControl.DropDown, then simply paste that line into the GotFocus or
    OnEntry event routine of every combobox that you want to act this way. It
    would at least save you having to type each combobox's name. I do that a lot
    and it's always worked for me.

    Pete



    "Yanick" <Yanick@discussions.microsoft.com> pí¹e v diskusním pøíspìvku
    news:FD9C9163-2188-428F-B5F2-2F37D6BB9DA3@microsoft.com...
    > Try something like this.
    >
    > Named all your combo box with the same name + a number : ex.:
    > Combobox1,Combobox2,Combobox3 ...
    >
    > Then with a for...next, access the drop down propertie.
    >
    > Dim i as integer
    >
    > For i = 1 to 3
    > Me("Combobox" & i).dropdown
    > next i
    >
    > Yanick
    >
    > "nshippers" wrote:
    >
    > > Thank you, Yanick! Just for anyone else who may want to do this, I

    created
    > > the following code (S_Q1 is a field, or question 1):
    > >
    > > Private Sub S_Q1_GotFocus()
    > > Me.S_Q1.Dropdown
    > > End Sub
    > >
    > > Is there a way, do you think, to have one code for all combo boxes of a
    > > form? I tried to fiddle with some coding, but unable to make it work.
    > >
    > > "Yanick" wrote:
    > >
    > > > Try Me.MyComboBox.Dropdown in either GotFocus Event or OnClick Event.
    > > >
    > > > Yanick
    > > >
    > > > "nshippers" wrote:
    > > >
    > > > > Our Access database is used for entering survey questionaire data.

    Many
    > > > > fields have combo boxes with several options.
    > > > >
    > > > > I would like the combo box look-up to open automatically when a

    person
    > > > > clicks or tabs over to a field box instead of having to press f4 as

    a
    > > > > shortcut.
    > > > >
    > > > > Any help would be appriciated!
     
  7. Peter Danes

    Peter Danes
    Expand Collapse
    Guest

    Actually, I just thought of a better way to do this while reading another
    post in this NG. You can write a common routine and call it directly from
    each event property that interests you.

    Create something like:

    Public Function DropMeBaby()
    ActiveControl.DropDown
    End Function

    Note that it MUST be a function, not a sub! Then put

    =DropMeBaby()

    in the event property box for any control/event where you want this to
    happen. Much simpler than my first suggestion (and whyinhell haven't I been
    doing this all along? Oh well.)

    Pete



    "Yanick" <Yanick@discussions.microsoft.com> pí¹e v diskusním pøíspìvku
    news:FD9C9163-2188-428F-B5F2-2F37D6BB9DA3@microsoft.com...
    > Try something like this.
    >
    > Named all your combo box with the same name + a number : ex.:
    > Combobox1,Combobox2,Combobox3 ...
    >
    > Then with a for...next, access the drop down propertie.
    >
    > Dim i as integer
    >
    > For i = 1 to 3
    > Me("Combobox" & i).dropdown
    > next i
    >
    > Yanick
    >
    > "nshippers" wrote:
    >
    > > Thank you, Yanick! Just for anyone else who may want to do this, I

    created
    > > the following code (S_Q1 is a field, or question 1):
    > >
    > > Private Sub S_Q1_GotFocus()
    > > Me.S_Q1.Dropdown
    > > End Sub
    > >
    > > Is there a way, do you think, to have one code for all combo boxes of a
    > > form? I tried to fiddle with some coding, but unable to make it work.
    > >
    > > "Yanick" wrote:
    > >
    > > > Try Me.MyComboBox.Dropdown in either GotFocus Event or OnClick Event.
    > > >
    > > > Yanick
    > > >
    > > > "nshippers" wrote:
    > > >
    > > > > Our Access database is used for entering survey questionaire data.

    Many
    > > > > fields have combo boxes with several options.
    > > > >
    > > > > I would like the combo box look-up to open automatically when a

    person
    > > > > clicks or tabs over to a field box instead of having to press f4 as

    a
    > > > > shortcut.
    > > > >
    > > > > Any help would be appriciated!
     

Share This Page