I have a textbox that I have the user enter a customer number and then they click the find button. The proble I have is that it looks to me like the every record in the db is being pulled and not filtered to just the one needed. Any help would be great.
Public Class frmNew
Inherits System.Windows.Forms.Form
Dim bLoading As Boolean
Dim bNewRow As Boolean
Dim MasterBindMgr As BindingManagerBase
Private Sub frmNew_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtFind.Focus()
MasterBindMgr = Me.BindingContext(DsMasterCust1, "tblMasterCustRecord")
End Sub
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
Dim iRecords As Integer
If txtFind.Text <> "" Then
bLoading = True
OleDbDataAdapter1.SelectCommand.Parameters("MCust").Value = txtFind.Text
DsMasterCust1.Clear()
iRecords = OleDbDataAdapter1.Fill(DsMasterCust1)
If iRecords = 0 Then
MessageBox.Show("Cust Number not Found!", "Entry Error")
txtFind.Focus()
Else
cmbCust.Focus()
End If
bLoading = False
Else
MessageBox.Show("You must enter a Cust Number.", "Entry Error")
txtFind.Focus()
End If
End Sub
Public Class frmNew
Inherits System.Windows.Forms.Form
Dim bLoading As Boolean
Dim bNewRow As Boolean
Dim MasterBindMgr As BindingManagerBase
Private Sub frmNew_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
txtFind.Focus()
MasterBindMgr = Me.BindingContext(DsMasterCust1, "tblMasterCustRecord")
End Sub
Private Sub btnFind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFind.Click
Dim iRecords As Integer
If txtFind.Text <> "" Then
bLoading = True
OleDbDataAdapter1.SelectCommand.Parameters("MCust").Value = txtFind.Text
DsMasterCust1.Clear()
iRecords = OleDbDataAdapter1.Fill(DsMasterCust1)
If iRecords = 0 Then
MessageBox.Show("Cust Number not Found!", "Entry Error")
txtFind.Focus()
Else
cmbCust.Focus()
End If
bLoading = False
Else
MessageBox.Show("You must enter a Cust Number.", "Entry Error")
txtFind.Focus()
End If
End Sub