Results 1 to 12 of 12
  1. #1
    Join Date
    Nov 2004
    Posts
    18

    Unanswered: show adapted list under textbox while typing

    Hello everybody,

    I'm not sure if I can explain this well in English but.. euhrm.. I'll try
    suppose: I have a tblNames with Id, Name, Comment.

    now in my form: when I'm writing a name in a textbox
    I would like to have a list that automaticly adapts while typing (filling
    the names that begin with the letters already typed.)

    For example: the following names are in my table: Dave, Dan, Daniel, ...

    So if I type 'D', all the three names should be displayed
    After that when I go on typing 'DAN': only Dan and Daniel should be listed!
    Now when I select a name in that list, the comment should be displayed
    in a label or something. This last should be no problem but I hope someone could help me with the list-thing

    I suppose that I have to use the keypress method of the textbox but
    I'm affraid I have to hit the DB everytime I type a letter. Am I right????

    I hope somebody can help
    THX
    deef

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    combos behave like this
    is there a reason not to do this in a combo?

    izy
    currently using SS 2008R2

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Quote Originally Posted by izyrider
    combos behave like this
    is there a reason not to do this in a combo?

    izy
    Indeed. This sounds like a combo would be a better application because it provides more options as well. Instead of only typing, a user can also use the drop down feature.
    oh yeah... documentation... I have heard of that.

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

  4. #4
    Join Date
    Nov 2004
    Posts
    18
    Maybe that's true, but does a combo expand automaticly when typing a name in it?
    Because I don't want to type a letter, click the arrow.. type a second one, click the arrow... and so on (if you know what I mean)

    If a combo does the job like I want, then I will use a combo!! LOL

    thx for the reactions already
    deef

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Try it and find out.
    oh yeah... documentation... I have heard of that.

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

  6. #6
    Join Date
    Nov 2004
    Posts
    18
    Okay, I tried a combobox and yes.. I got him showing a list of names while typing. But! I have a problem refreshing this list

    I have this query in the "row source" of the combo
    Code:
    SELECT Name FROM tblNames WHERE Name LIKE cboNames.Value & "*" ORDER BY Name
    and the following code in the KeyPress-procedure of the combo:
    Code:
    cboNames.Requery
    cboNames.DropDown
    When I run my form, the first time I want to write in my combo.. a popupwindow shows up asking for a parameter value for the combo.
    I type something and after clicking OK the combo shows just what I want!
    BUT... if I want to write more in the combo, I get the following error:

    "You must save the current field before you run the Requery action"

    What does he mean by that?? And what can I do for NOT getting that popup-window?

    Thx for the advice
    deef

  7. #7
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    uh...


    "SELECT Name FROM tblNames"

    That's it.

    No code, no updates, no requery.
    oh yeah... documentation... I have heard of that.

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

  8. #8
    Join Date
    Nov 2004
    Posts
    18
    But then he shows the full list of names, and I just want to show those names that begin with the letters typed in the combo. You see??

  9. #9
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    As the user types, the list will be pared down automagically. Just try it.
    oh yeah... documentation... I have heard of that.

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

  10. #10
    Join Date
    Nov 2004
    Posts
    18
    Yes that's true, I've tried that already. But the list shows ALL the names from the table. I just want to show the names that begin with the letters I'm typing in the combo's textbox. While I'm typing the list should get shorter because I'm giving more and more letters away
    Like I mentioned before: suppose Dave, Dan and Daniel are in my table. When I type "D"; the three names still meet the query but when I'm at "DAN"; only Dan and Daniel should be shown in the list.

    Okay, this looks a little dumb for a few names.. but for a huge list it could be very handy

  11. #11
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    I guess... Use this if you just OMGHAVETO hide names that don't match. Seems like you're wasting an awful lot of processing for cosmetics when the user sees the whole list to begin with anyways, but hey, you're call.

    "SELECT Name FROM tblNames WHERE Name LIKE '" & cboNames.Value & "*' ORDER BY Name"
    oh yeah... documentation... I have heard of that.

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

  12. #12
    Join Date
    Nov 2004
    Posts
    18
    thx for helping.. I will try it out later the evening! Got to go now... keep it up and thanks again

    greetz
    deef

Posting Permissions

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