Hi
I have set up a datagridview control on a form that displays a .MDB file, what i now want to do is place a search button and a text box on the form so when the user types a catalogue number into the text box, the daagridview will jump straight to that item in the database.
The database has about 3000 entries and will not be used for updating deleting etc, just read only.
My code is like this and was used in a VB6 database project. My problem in ADO.NET appears to be in the datPrimaryRS.MoveFirst and the datPrimaryRS.Find .
A modified code snippett would be appreciated
Regards
Rob
Option Explicit
' variables for data binding
Private datPrimaryRS As ADODB.Recordset
Private Sub Command1_Click()
Dim userin As String
userin = Text1.Text
If userin = "" Then
MsgBox "Please enter a catalogue number to continue", vbExclamation, "Search"
Else
datPrimaryRS.MoveFirst
datPrimaryRS.Find ("[Cat No]like '" & userin & "*'")
Text1.Text = ""
If datPrimaryRS.EOF Then
MsgBox "Catalogue number not recognized, please try again.", vbExclamation, "Search Result"
datPrimaryRS.MoveFirst
Text1.Text = ""
End If
End If