
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