Access Combo Box search allowing seacr on multiple fields

Ask a Question related to Microsoft Access, Design and Development.

  1. #1

    Default Access Combo Box search allowing seacr on multiple fields

    Question:
    In a table the first field is the Customer number and the
    second field is the Customer name. I want to create a
    single combo box so it will accept both the customer
    number or the name and search accordingly.
    Say I first type in a number, the box will recognise to
    use the Number field for search, if I type an alpha
    character it will recognise it and search on the name
    field. I'm experienced with VB coding. The AVB code looks
    the same for both type of combo box, the only difference
    is in the 'Colunm width' if you search by nuber usually
    the first column and the column length is set to zero.
    L Balogh Guest

  2. Similar Questions and Discussions

    1. One Search String/Multiple Fields
      Hello! What I am trying to do is create a query page for my users that allows them to enter one search string (var=#string#) and then click...
    2. PHP MySQL search same name in multiple dbase fields
      How do I search two fields (e.g., "lastName" and "maidenName") using one name (but can be more than 1 word) so one can find a record for a woman for...
    3. Search multiple keywords across multiple fields
      Hi, I'm about halfway through building a search engine using ASP, SQL and Access. As part of that search engine I need to search multiple...
    4. multiple combo boxes with three related fields
      On Tue, 22 Jul 2003 20:35:44 -0700, "Don Albaugh" <donald.albaugh@med.va.gov> wrote: The simplest way is to follow the idea in your last...
    5. SQL Search Multiple Fields ??
      James wrote: Yes. Well, just execute this SQL statement using the PHP extension for the SQL server you're using. By the way: how does...
  3. #2

    Default Re: Access Combo Box search allowing seacr on multiple fields

    Well, I supppose you could set the RowSource of the combo to a UNION query
    that combines the customer number and name into the visible column, but that
    doesn't sound like a great interface to me.

    Would it not be better to use two unbound controls: a combo with the names,
    and a text box for the customer number? The AfterUpdate event procedure of
    each would FindFirst in the form's RecordsetClone, and I think it's clearer
    for the user to understand.

    --
    Allen Browne - Microsoft MVP. Perth, Western Australia.
    Tips for Access users - [url]http://allenbrowne.com/tips.html[/url]
    Reply to the newsgroup. (Email address has spurious "_SpamTrap")

    "L Balogh" <lst@bigpond.net.au> wrote in message
    news:061101c33ee2$15945700$a301280a@phx.gbl...
    > Question:
    > In a table the first field is the Customer number and the
    > second field is the Customer name. I want to create a
    > single combo box so it will accept both the customer
    > number or the name and search accordingly.
    > Say I first type in a number, the box will recognise to
    > use the Number field for search, if I type an alpha
    > character it will recognise it and search on the name
    > field. I'm experienced with VB coding. The AVB code looks
    > the same for both type of combo box, the only difference
    > is in the 'Colunm width' if you search by nuber usually
    > the first column and the column length is set to zero.

    Allen Browne Guest

  4. #3

    Default Re: Access Combo Box search allowing seacr on multiple fields

    I would not use a combo if your users are going to be able to search for
    more then one type of value.

    By the way, I OFTEN also make my search boxes intelligent, and search on
    more then one value. (say, LastName, Companies, and invoice number).

    If the users types in a invoice number, then I search by number.

    Don't torture your users with a combo box for search. I Mean, after 100
    entries, a combo box is way too much.

    Just build a normal text box, and in the after update event of the field,
    stuff the sql results into a sub form, or a list box.

    The code to do this can look like:

    If IsNumeric(txtSLastName) = True Then
    ' number for last name...lets assume this is a invoice number
    '
    myconds = "InvoiceNumber = " & txtSLastName
    Else
    myconds = "(LastName like " & quS(txtSLastName) & ") "
    end if

    MySql = CurrentDb.QueryDefs(strSearchQuery).SQL

    ' get rid of the ";"

    MySql = Left(MySql, InStr(MySql, ";") - 1)

    MySql = MySql & " where " & myconds
    MySql = MySql & myorder

    Me.tblMainClient_subform.Form.RecordSource = MySql

    You can see a screen shot of the above in action at:

    [url]http://www.attcanada.net/~kallal.msn/Search/index.html[/url]

    In fact, here is another one with drill down:
    [url]http://www.attcanada.net/~kallal.msn/test/gs1.gif[/url]

    It works the same as the first example. However, it drills down. On the left
    side is a listbox, and on the right side is a sub-form. I used a sub-form on
    the right side since I wanted to display the check box.

    If you hit the up arrow a few times, then the details on the right side
    change:
    [url]http://www.attcanada.net/~kallal.msn/test/gs2.gif[/url]


    Also, if you look closely in the first search example, I actually use a
    combo box so the user can select stuff like email name, or phone number for
    the search.


    --
    Albert D. Kallal (MVP)
    Edmonton, Alberta Canada
    [email]kallal@msn.com[/email]
    [url]http://www.attcanada.net/~kallal.msn[/url]


    Albert D. Kallal Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139