Results 1 to 2 of 2

Thread: using Combo boxes to search databases

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 1999
    Location
    Belfast
    Posts
    1

    Post

    In Access there is a very useful wizard which allow you to use a combo boxes to pick out a record in a database. I have been trying to do this in VB but I am not getting anywhere - any help would be appreciated.

  2. #2
    Frenzied Member
    Join Date
    Aug 1999
    Location
    Santa Clara, Ca , 95058
    Posts
    1,105

    Post

    Should be easy enough to do, you just have to do it yourself.

    Ideally, the combo boxes the user uses should contain enough information to retrieve a unique record. If this isn't possible, and the record counts in the table is small enough, you could consider retrieving based upon record position. This would require, in SQL, an "order by" clause in your select statement (for both the combo box population and the data retrieval) to ensure the data is consistently retrieved in the same order. You could use the index value from the combo box to determine the number of table reads to perform. Consideration should also be given to pre-fetching the data and storing it in an array (if possible. An ideal table, for this approach, would be one that isn't likely to change much, a read only table for example).

    If the record counts in the table are large, consideration might be given to adding an sequencing field to the table, that would be used in the retrieval phase (for population of the combo box). Then the data retrieval SQL query would look something like:

    select data from table where seqno=combo.selected.index

Posting Permissions

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



Click Here to Expand Forum to Full Width