Quickly sorting records...... 
Author Message
 Quickly sorting records......

Hi,
I want to write a quick application that does the following.

Using a text box, I want the user to start entering the number of the
part that they are looking for in the database.
As they enter more letters/numbers, I want to reposition a "view" of
the database (not sure what I shall use, but a list box seems
favourite) so as it shows the closest match to the record that the
user is typing in,  Once they select the record from the list box or
whatever, they will be shown the contents of it briefly on the right
hand side of the window.

This is just to provide a quick interface for the sales manager to see
what items are in stock so he can decide what he can sell.

Any help greatly receieved via E-Mail if possible, as I don;t have a
reliable news feed :-(

Thanks all!

Dan Lyon



Sun, 07 Feb 1999 03:00:00 GMT  
 Quickly sorting records......

Quote:

> Hi,
> I want to write a quick application that does the following.

> Using a text box, I want the user to start entering the number of the
> part that they are looking for in the database.
> As they enter more letters/numbers, I want to reposition a "view" of
> the database (not sure what I shall use, but a list box seems
> favourite) so as it shows the closest match to the record that the
> user is typing in,  Once they select the record from the list box or
> whatever, they will be shown the contents of it briefly on the right
> hand side of the window.

> This is just to provide a quick interface for the sales manager to see
> what items are in stock so he can decide what he can sell.

> Any help greatly receieved via E-Mail if possible, as I don;t have a
> reliable news feed :-(

> Thanks all!

> Dan Lyon

Use a dropdown combobox and make the listbox portion permanently showing.
When the user types in letters in the edit box, the list box will
automatically search for an entry that might match it.


Mon, 08 Feb 1999 03:00:00 GMT  
 Quickly sorting records......

Quote:

>Hi,
>I want to write a quick application that does the following.
>Using a text box, I want the user to start entering the number of the
>part that they are looking for in the database.
>As they enter more letters/numbers, I want to reposition a "view" of
>the database (not sure what I shall use, but a list box seems
>favourite) so as it shows the closest match to the record that the
>user is typing in,  Once they select the record from the list box or
>whatever, they will be shown the contents of it briefly on the right
>hand side of the window.

I would use a grid to display and use the Findfirst method on the
bound datacontrol.  The Findfirst method will search for partial
matches if given a wildcard.

For example:

Private Sub Text1_Change()
   Dim lstrTemp As String

   lstrTemp = Trim(Text1.Text)
   If Len(lstrTemp) > 0 Then
     Data1.Recordset.FindFirst "Author Like '" & lstrTemp & "*'"
   End If

End Sub

Notice the asterick at the end of the like statement.

Rick Clark



Tue, 09 Feb 1999 03:00:00 GMT  
 Quickly sorting records......

Quote:
> This is just to provide a quick interface for the sales manager to see
> what items are in stock so he can decide what he can sell.

Why not use a data control populated by a SQL statement that attaches to a
data grid?  If you sort it by part number, the manager can just use the
scroll bar on the grid.  A code starter follows; I'm sure it has some
object syntax errors that you'll have to correct.

' module-level declarations
dim mdbDatabase as database
dim mrsData as recordset

Private Sub PopulateDataGrid()
Dim strSQL as string
set mdbDatabase = Workspaces(0).OpenDatabase("C:\Path\DB.MDB")
strSQL = "select PartNum, PartDesc, Inventory from Parts where Inventory >
0 order by PartNum"
Set mrsData as mdbDatabase.OpenRecordset(strSQL,dbOpenTable)
datData.recordset = mrsData
End Sub

Private Sub txtPartSearch_Change()
mrsData.recordset.seek ">=", txtPartSearch ' implying that the part number
field is the key
if mrsData.recordset.nomatch then
        mrsData.recordset.movefirst
end if
End Sub

After you debug the above code, it should work so that every character
typed by the manager will position the recordset's bookmark (and thus the
data grid's row) to the record whose part number is greater than or equal
to the value of the text box.  Since the procedure uses the Seek method, it
should go fairly quickly.  So, typing "A3" would set the bookmark to the
record whose part number is "A30000," if 'A30000' is the first part number
in the A group, because "A30000" is greater in value than "A3."

Please get back to me if this helps at all.

-Tim Bartlett
--------------



Quote:
> Hi,
> I want to write a quick application that does the following.

> Using a text box, I want the user to start entering the number of the
> part that they are looking for in the database.
> As they enter more letters/numbers, I want to reposition a "view" of
> the database (not sure what I shall use, but a list box seems
> favourite) so as it shows the closest match to the record that the
> user is typing in,  Once they select the record from the list box or
> whatever, they will be shown the contents of it briefly on the right
> hand side of the window.

> This is just to provide a quick interface for the sales manager to see
> what items are in stock so he can decide what he can sell.

> Any help greatly receieved via E-Mail if possible, as I don;t have a
> reliable news feed :-(

> Thanks all!

> Dan Lyon



Fri, 12 Feb 1999 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Sorting a large variable list VERY quickly.

2. Deleting records quickly

3. VB5 /Access2: Sorting Records after an ADD record event

4. Sort order - Edit Filter Sort or Quick Sort

5. Sort & Recalculate a Record Number

6. sorting records from 1 table into several based on a field value

7. Sorting Records in a Report

8. How to sort AND edit records

9. Sorting Records in a Form

10. Sorting Records in a Form

11. Sorting Records in Subform with Code

12. Problem in finding right record in dataset after sorting datagrid

 

 
Powered by phpBB® Forum Software