matt_swinburne
asked on
Database Search
I am creating a front end for an access database which displays data in text and combo boxes. When you click a search button on the main form it will open another form which has a combobox on so that you can select to search by name, or box number. Then when you have entered your data and selected what to search by I would like the application to switch back to the main form and update the text/comboboxes.
Any help Appreciated
Any help Appreciated
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Tanks for the answer and the link
I made a small error in my post, wrong sequence
'use your currencymanager to jump to the correct record, your currency manager shoudl be public as well
directcast(me.owner,form1) .dv.sort = "statusid"
dim x as integer = directcast(me.owner,form1) .dv.find(1 2)
directcast(me.owner,form1) .cm.positi on = x
'use your currencymanager to jump to the correct record, your currency manager shoudl be public as well
directcast(me.owner,form1)
dim x as integer = directcast(me.owner,form1)
directcast(me.owner,form1)
ASKER
Will this interfere with any of my program as it stands Ronald?
Yes , it will :-(, since it will require you to bind to a dataview instead of datatable.
We could however,maybe get around this little problem, I'm going home now but I will work on it tomorrow.
to hint, you could pass a dataview to the search form locate the record in there and pass the recordnumber back to the main form. you could then use this to set the position with the currencymanager
to hint, you could pass a dataview to the search form locate the record in there and pass the recordnumber back to the main form. you could then use this to set the position with the currencymanager
ASKER
Ignore last post
On;
DirectCast(Me.Owner, Form1).cm.position = x (in search form on search button)
I get;
'WindowsApplication3.Form1 .cm' is not accessible in this context because it is 'Private'.
On;
DirectCast(Me.Owner, Form1).cm.position = x (in search form on search button)
I get;
'WindowsApplication3.Form1
ASKER
(I did rename the form to public.)
Thanks for assistance speak to you tommorow
Thanks for assistance speak to you tommorow
ASKER
what would the code look like to jump to the correct spot using the currency manager. I made currency manager public but i get cm is not declared when in BtnSearch_Click (on search form)
ASKER
I have decided to have the search on the one main form to make things simpler. Dont know if this makes things simpler for you?
Hi Matt,
Sorry I didn't answer yesterday (I forgot it was a national holiday over here :-))
On what do you want to let the user search (on which table and which columns ?
Sorry I didn't answer yesterday (I forgot it was a national holiday over here :-))
On what do you want to let the user search (on which table and which columns ?
ASKER
Hi Ronald, you had a good one i hope?
To answer your question I would like to search on the table Main and I would like to search on Matter Number, Box Number and Client name.
To answer your question I would like to search on the table Main and I would like to search on Matter Number, Box Number and Client name.
ASKER
I now use this code:
Main Form
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim dv As DataView
Dim cm As CurrencyManager
Dim Constr As String = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=C:\Documents and Settings\matthewm\Desktop\ File Tracking.mdb;Persist Security Info=False"
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DA As New OleDbDataAdapter("Select * From Emp", Constr)
Dim DT As New DataTable
>> DA.Fill(DT) << Error
dv = DT.DefaultView
cm = CType(Me.BindingContext(dv ), CurrencyManager)
TxtClient.DataBindings.Add ("Text", dv, "ClientName")
TxtMatterNumber.DataBindin gs.Add("Te xt", dv, "MatterNo")
TxtCloseDate.DataBindings. Add("Text" , dv, "CloseDate")
TxtNotes.DataBindings.Add( "Text", dv, "Notes")
TxtBox.DataBindings.Add("T ext", dv, "BoxNumber")
TxtDateIn.DataBindings.Add ("Text", dv, "DateIn")
TxtStoreDate.DataBindings. Add("Text" , dv, "StoreDate")
TxtDateRemoved.DataBinding s.Add("Tex t", dv, "RemoveDate")
TxtDestroyDate.DataBinding s.Add("Tex t", dv, "DestroyDate")
'Load Originating Location Combo
CmbLocation.DataSource = dv
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A dd("select edvalue", dv, "LocationID")
'Load FeeEarner ComboBox
CmbFeeEarner.DataSource = dv
CmbFeeEarner.DisplayMember = "FeeEarnerName"
CmbFeeEarner.ValueMember = "FeeEarnerID"
CmbFeeEarner.DataBindings. Add("selec tedvalue", dv, "FeeEarnerID")
'Load MatterType Combobox
CmbMatter.DataSource = dv
CmbMatter.DisplayMember = "MatterTypeName"
CmbMatter.ValueMember = "MatterTypeID"
CmbMatter.DataBindings.Add ("selected value", dv, "MatterTypeID")
'Load Status Combobox
CmbStatus.DataSource = dv
CmbStatus.DisplayMember = "StorageName"
CmbStatus.ValueMember = "StorageID"
CmbStatus.DataBindings.Add ("selected value", dv, "StatusID")
'Load Office Combobox
CmbOffice.DataSource = dv
CmbOffice.DisplayMember = "OfficeName"
CmbOffice.ValueMember = "OfficeID"
CmbOffice.DataBindings.Add ("selected value", dv, "OfficeName")
End Sub
Private Sub NavigationButtons_Click(By Val sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click, BtnLast.Click, BtnNext.Click, BtnPrevious.Click
Select Case sender.Name
Case "BtnFirst"
cm.Position = 0
Case "BtnPrevious"
cm.Position -= 1
Case "BtnNext"
cm.Position += 1
Case "BtnLast"
cm.Position = DataSet11.Tables("Main").R ows.Count - 1
End Select
End Sub
Private Sub BtnMainSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMainSearch.Click
Dim objFind As New Search
Dim Name As String
If objFind.ShowDialog = DialogResult.OK Then
Name = objFind.Name
dv.Sort = "ClientName"
dv.RowFilter = "ClientName='" & Name & "'"
End If
End Sub
End Class
Search Form:
Public Class Search
Inherits System.Windows.Forms.Form
Dim mName As String
Public ReadOnly Property Client() As String
Get
Name = mName
End Get
End Property
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
mName = TxtSearch.Text
Me.DialogResult = DialogResult.OK
End Sub
End Class
However I get an error on the line:
DA.Fill(DT) -- On the main Form
An unhandled exception of type 'System.Data.OleDb.OleDbEx ception' occurred in system.data.dll
Main Form
Imports System.Data.OleDb
Public Class Form1
Inherits System.Windows.Forms.Form
Dim dv As DataView
Dim cm As CurrencyManager
Dim Constr As String = "Provider=Microsoft.Jet.OL
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DA As New OleDbDataAdapter("Select * From Emp", Constr)
Dim DT As New DataTable
>> DA.Fill(DT) << Error
dv = DT.DefaultView
cm = CType(Me.BindingContext(dv
TxtClient.DataBindings.Add
TxtMatterNumber.DataBindin
TxtCloseDate.DataBindings.
TxtNotes.DataBindings.Add(
TxtBox.DataBindings.Add("T
TxtDateIn.DataBindings.Add
TxtStoreDate.DataBindings.
TxtDateRemoved.DataBinding
TxtDestroyDate.DataBinding
'Load Originating Location Combo
CmbLocation.DataSource = dv
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A
'Load FeeEarner ComboBox
CmbFeeEarner.DataSource = dv
CmbFeeEarner.DisplayMember
CmbFeeEarner.ValueMember = "FeeEarnerID"
CmbFeeEarner.DataBindings.
'Load MatterType Combobox
CmbMatter.DataSource = dv
CmbMatter.DisplayMember = "MatterTypeName"
CmbMatter.ValueMember = "MatterTypeID"
CmbMatter.DataBindings.Add
'Load Status Combobox
CmbStatus.DataSource = dv
CmbStatus.DisplayMember = "StorageName"
CmbStatus.ValueMember = "StorageID"
CmbStatus.DataBindings.Add
'Load Office Combobox
CmbOffice.DataSource = dv
CmbOffice.DisplayMember = "OfficeName"
CmbOffice.ValueMember = "OfficeID"
CmbOffice.DataBindings.Add
End Sub
Private Sub NavigationButtons_Click(By
Select Case sender.Name
Case "BtnFirst"
cm.Position = 0
Case "BtnPrevious"
cm.Position -= 1
Case "BtnNext"
cm.Position += 1
Case "BtnLast"
cm.Position = DataSet11.Tables("Main").R
End Select
End Sub
Private Sub BtnMainSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnMainSearch.Click
Dim objFind As New Search
Dim Name As String
If objFind.ShowDialog = DialogResult.OK Then
Name = objFind.Name
dv.Sort = "ClientName"
dv.RowFilter = "ClientName='" & Name & "'"
End If
End Sub
End Class
Search Form:
Public Class Search
Inherits System.Windows.Forms.Form
Dim mName As String
Public ReadOnly Property Client() As String
Get
Name = mName
End Get
End Property
Private Sub BtnSearch_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnSearch.Click
mName = TxtSearch.Text
Me.DialogResult = DialogResult.OK
End Sub
End Class
However I get an error on the line:
DA.Fill(DT) -- On the main Form
An unhandled exception of type 'System.Data.OleDb.OleDbEx
ASKER
Sorry blatent error: Dim DA As New OleDbDataAdapter("Select * From Emp", Constr)
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Now i get Could not bind to the new display member.
on
CmbStatus.ValueMember = "StorageID"
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Now i get Could not bind to the new display member.
on
CmbStatus.ValueMember = "StorageID"
Well , you can't do what you are doing because the dv (which is table main) doesn't have the things like storagename, FeeEarnerNam etc, (just the IDs) because the were in other tables weren't they?
Could you post the code you have now, and I'll work something out for you :-)
Could you post the code you have now, and I'll work something out for you :-)
ASKER
Hi Ronald, This isnt my database which is why it isnt very well constructed. Went into the database and changed the field names to match. Now works.
1st Problem:
Database access seems reeaally slow.
2nd Problem:
The search doesnt return any results just leaves the fields blank
3rd Problem:
I would like the user to select from a dropdown menu on the search form to pick whether they would like to search by Boxno, matter no or name
Is all this possible do you know?
1st Problem:
Database access seems reeaally slow.
2nd Problem:
The search doesnt return any results just leaves the fields blank
3rd Problem:
I would like the user to select from a dropdown menu on the search form to pick whether they would like to search by Boxno, matter no or name
Is all this possible do you know?
Yes it is all possible, but some extra questions, Do you want to allow them to search on more than 1 item, and do you want to be able to search on a part the name
ASKER
The client name might have more than one record per client so I would like it tobe able to return more than one record. And yes I need the user to be able to search on part of the name and not just the full name. Is that what you were asking?
Yep, I'll be back
Ok consider this example (you can just cut and paste these 2 forms, they should work on their own)
This example has 2 forms (form17, FrmSearch) when you press the search button it will open form2 which has a combobox a textbox and a button, they can choose which column to search on in the combobox and in the textbox they can enter a (part) text to search on.
Public Class Form17
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextB ox
Friend WithEvents TextBox2 As System.Windows.Forms.TextB ox
Friend WithEvents BtnPrevious As System.Windows.Forms.Butto n
Friend WithEvents BtnNext As System.Windows.Forms.Butto n
Friend WithEvents BtnLast As System.Windows.Forms.Butto n
Friend WithEvents BtnFirst As System.Windows.Forms.Butto n
Friend WithEvents BtnSearch As System.Windows.Forms.Butto n
Friend WithEvents Button1 As System.Windows.Forms.Butto n
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextB ox
Me.TextBox2 = New System.Windows.Forms.TextB ox
Me.BtnPrevious = New System.Windows.Forms.Butto n
Me.BtnNext = New System.Windows.Forms.Butto n
Me.BtnSearch = New System.Windows.Forms.Butto n
Me.BtnLast = New System.Windows.Forms.Butto n
Me.BtnFirst = New System.Windows.Forms.Butto n
Me.Button1 = New System.Windows.Forms.Butto n
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(8, 24)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(80, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(8, 48)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(80, 20)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'BtnPrevious
'
Me.BtnPrevious.Location = New System.Drawing.Point(70, 121)
Me.BtnPrevious.Name = "BtnPrevious"
Me.BtnPrevious.Size = New System.Drawing.Size(40, 24)
Me.BtnPrevious.TabIndex = 9
Me.BtnPrevious.Text = "<"
'
'BtnNext
'
Me.BtnNext.Location = New System.Drawing.Point(182, 121)
Me.BtnNext.Name = "BtnNext"
Me.BtnNext.Size = New System.Drawing.Size(40, 24)
Me.BtnNext.TabIndex = 8
Me.BtnNext.Text = ">"
'
'BtnSearch
'
Me.BtnSearch.Location = New System.Drawing.Point(110, 121)
Me.BtnSearch.Name = "BtnSearch"
Me.BtnSearch.Size = New System.Drawing.Size(72, 24)
Me.BtnSearch.TabIndex = 7
Me.BtnSearch.Text = "Filter"
'
'BtnLast
'
Me.BtnLast.Location = New System.Drawing.Point(222, 121)
Me.BtnLast.Name = "BtnLast"
Me.BtnLast.Size = New System.Drawing.Size(40, 24)
Me.BtnLast.TabIndex = 6
Me.BtnLast.Text = ">>"
'
'BtnFirst
'
Me.BtnFirst.Location = New System.Drawing.Point(30, 121)
Me.BtnFirst.Name = "BtnFirst"
Me.BtnFirst.Size = New System.Drawing.Size(40, 24)
Me.BtnFirst.TabIndex = 5
Me.BtnFirst.Text = "<<"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(110, 152)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 10
Me.Button1.Text = "Clear filter"
'
'Form17
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1 )
Me.Controls.Add(Me.BtnPrev ious)
Me.Controls.Add(Me.BtnNext )
Me.Controls.Add(Me.BtnSear ch)
Me.Controls.Add(Me.BtnLast )
Me.Controls.Add(Me.BtnFirs t)
Me.Controls.Add(Me.TextBox 2)
Me.Controls.Add(Me.TextBox 1)
Me.Name = "Form17"
Me.Text = "Clear Filter"
Me.ResumeLayout(False)
End Sub
#End Region
Dim dt As New DataTable
Public dv As DataView
Dim cm As CurrencyManager
Dim CurrentRecord As Integer
Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName" , GetType(System.String))
dt.Columns.Add("LastName", GetType(System.String))
Dim dr As DataRow
dr = dt.NewRow
dr.Item("ID") = 1
dr.Item("FirstName") = "John"
dr.Item("LastName") = "Do"
dt.Rows.Add(dr)
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
dv = dt.DefaultView
TextBox1.DataBindings.Add( "text", dv, "FirstName")
TextBox2.DataBindings.Add( "text", dv, "LastName")
cm = CType(Me.BindingContext(dv ), CurrencyManager)
End Sub
Public Sub FindRecords(ByVal SearchPattern As String)
dv.RowFilter = SearchPattern
End Sub
Private Sub NavigationButtons_Click(By Val sender As System.Object, ByVal e As System.EventArgs) Handles BtnFirst.Click, BtnLast.Click, BtnNext.Click, BtnPrevious.Click, BtnSearch.Click
Select Case sender.Name
Case "BtnFirst"
cm.Position = 0
Case "BtnPrevious"
cm.Position -= 1
Case "BtnNext"
cm.Position += 1
Case "BtnLast"
cm.Position = dv.Count - 1
Case "BtnSearch"
Dim fs As New FrmSearch
fs.Owner = Me
fs.ShowDialog()
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dv.RowFilter = ""
End Sub
End Class
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon tainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Butto n
Friend WithEvents TextBox1 As System.Windows.Forms.TextB ox
Friend WithEvents ComboBox1 As System.Windows.Forms.Combo Box
<System.Diagnostics.Debugg erStepThro ugh()> Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextB ox
Me.Button1 = New System.Windows.Forms.Butto n
Me.ComboBox1 = New System.Windows.Forms.Combo Box
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(48, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(128, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 80)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 32)
Me.Button1.TabIndex = 2
Me.Button1.Text = "OK"
'
'ComboBox1
'
Me.ComboBox1.Items.AddRang e(New Object() {"FirstName", "Lastname"})
Me.ComboBox1.Location = New System.Drawing.Point(48, 8)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(128, 21)
Me.ComboBox1.TabIndex = 3
'
'FrmSearch
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(240, 134)
Me.Controls.Add(Me.ComboBo x1)
Me.Controls.Add(Me.Button1 )
Me.Controls.Add(Me.TextBox 1)
Me.Name = "FrmSearch"
Me.Text = "FrmSearch"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sstring As String
Select Case ComboBox1.SelectedItem.ToS tring
Case Is = "LastName"
sstring = "LastName like '" & TextBox1.Text & "*'"
Case Is = "FirstName"
sstring = "FirstName like '" & TextBox1.Text & "*'"
End Select
CType(Me.Owner, Form17).FindRecords(sstrin g)
Me.Close()
End Sub
End Class
This example has 2 forms (form17, FrmSearch) when you press the search button it will open form2 which has a combobox a textbox and a button, they can choose which column to search on in the combobox and in the textbox they can enter a (part) text to search on.
Public Class Form17
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextB
Friend WithEvents TextBox2 As System.Windows.Forms.TextB
Friend WithEvents BtnPrevious As System.Windows.Forms.Butto
Friend WithEvents BtnNext As System.Windows.Forms.Butto
Friend WithEvents BtnLast As System.Windows.Forms.Butto
Friend WithEvents BtnFirst As System.Windows.Forms.Butto
Friend WithEvents BtnSearch As System.Windows.Forms.Butto
Friend WithEvents Button1 As System.Windows.Forms.Butto
<System.Diagnostics.Debugg
Me.TextBox1 = New System.Windows.Forms.TextB
Me.TextBox2 = New System.Windows.Forms.TextB
Me.BtnPrevious = New System.Windows.Forms.Butto
Me.BtnNext = New System.Windows.Forms.Butto
Me.BtnSearch = New System.Windows.Forms.Butto
Me.BtnLast = New System.Windows.Forms.Butto
Me.BtnFirst = New System.Windows.Forms.Butto
Me.Button1 = New System.Windows.Forms.Butto
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(8, 24)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(80, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = ""
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(8, 48)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(80, 20)
Me.TextBox2.TabIndex = 1
Me.TextBox2.Text = ""
'
'BtnPrevious
'
Me.BtnPrevious.Location = New System.Drawing.Point(70, 121)
Me.BtnPrevious.Name = "BtnPrevious"
Me.BtnPrevious.Size = New System.Drawing.Size(40, 24)
Me.BtnPrevious.TabIndex = 9
Me.BtnPrevious.Text = "<"
'
'BtnNext
'
Me.BtnNext.Location = New System.Drawing.Point(182, 121)
Me.BtnNext.Name = "BtnNext"
Me.BtnNext.Size = New System.Drawing.Size(40, 24)
Me.BtnNext.TabIndex = 8
Me.BtnNext.Text = ">"
'
'BtnSearch
'
Me.BtnSearch.Location = New System.Drawing.Point(110, 121)
Me.BtnSearch.Name = "BtnSearch"
Me.BtnSearch.Size = New System.Drawing.Size(72, 24)
Me.BtnSearch.TabIndex = 7
Me.BtnSearch.Text = "Filter"
'
'BtnLast
'
Me.BtnLast.Location = New System.Drawing.Point(222, 121)
Me.BtnLast.Name = "BtnLast"
Me.BtnLast.Size = New System.Drawing.Size(40, 24)
Me.BtnLast.TabIndex = 6
Me.BtnLast.Text = ">>"
'
'BtnFirst
'
Me.BtnFirst.Location = New System.Drawing.Point(30, 121)
Me.BtnFirst.Name = "BtnFirst"
Me.BtnFirst.Size = New System.Drawing.Size(40, 24)
Me.BtnFirst.TabIndex = 5
Me.BtnFirst.Text = "<<"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(110, 152)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 24)
Me.Button1.TabIndex = 10
Me.Button1.Text = "Clear filter"
'
'Form17
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(292, 266)
Me.Controls.Add(Me.Button1
Me.Controls.Add(Me.BtnPrev
Me.Controls.Add(Me.BtnNext
Me.Controls.Add(Me.BtnSear
Me.Controls.Add(Me.BtnLast
Me.Controls.Add(Me.BtnFirs
Me.Controls.Add(Me.TextBox
Me.Controls.Add(Me.TextBox
Me.Name = "Form17"
Me.Text = "Clear Filter"
Me.ResumeLayout(False)
End Sub
#End Region
Dim dt As New DataTable
Public dv As DataView
Dim cm As CurrencyManager
Dim CurrentRecord As Integer
Private Sub Form17_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName"
dt.Columns.Add("LastName",
Dim dr As DataRow
dr = dt.NewRow
dr.Item("ID") = 1
dr.Item("FirstName") = "John"
dr.Item("LastName") = "Do"
dt.Rows.Add(dr)
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
dv = dt.DefaultView
TextBox1.DataBindings.Add(
TextBox2.DataBindings.Add(
cm = CType(Me.BindingContext(dv
End Sub
Public Sub FindRecords(ByVal SearchPattern As String)
dv.RowFilter = SearchPattern
End Sub
Private Sub NavigationButtons_Click(By
Select Case sender.Name
Case "BtnFirst"
cm.Position = 0
Case "BtnPrevious"
cm.Position -= 1
Case "BtnNext"
cm.Position += 1
Case "BtnLast"
cm.Position = dv.Count - 1
Case "BtnSearch"
Dim fs As New FrmSearch
fs.Owner = Me
fs.ShowDialog()
End Select
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
dv.RowFilter = ""
End Sub
End Class
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.ICon
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents Button1 As System.Windows.Forms.Butto
Friend WithEvents TextBox1 As System.Windows.Forms.TextB
Friend WithEvents ComboBox1 As System.Windows.Forms.Combo
<System.Diagnostics.Debugg
Me.TextBox1 = New System.Windows.Forms.TextB
Me.Button1 = New System.Windows.Forms.Butto
Me.ComboBox1 = New System.Windows.Forms.Combo
Me.SuspendLayout()
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(48, 40)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(128, 20)
Me.TextBox1.TabIndex = 1
Me.TextBox1.Text = ""
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(88, 80)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(56, 32)
Me.Button1.TabIndex = 2
Me.Button1.Text = "OK"
'
'ComboBox1
'
Me.ComboBox1.Items.AddRang
Me.ComboBox1.Location = New System.Drawing.Point(48, 8)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(128, 21)
Me.ComboBox1.TabIndex = 3
'
'FrmSearch
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(240, 134)
Me.Controls.Add(Me.ComboBo
Me.Controls.Add(Me.Button1
Me.Controls.Add(Me.TextBox
Me.Name = "FrmSearch"
Me.Text = "FrmSearch"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim sstring As String
Select Case ComboBox1.SelectedItem.ToS
Case Is = "LastName"
sstring = "LastName like '" & TextBox1.Text & "*'"
Case Is = "FirstName"
sstring = "FirstName like '" & TextBox1.Text & "*'"
End Select
CType(Me.Owner, Form17).FindRecords(sstrin
Me.Close()
End Sub
End Class
sorry this was missing at the top of the second form
Public Class FrmSearch
Inherits System.Windows.Forms.Form
Public Class FrmSearch
Inherits System.Windows.Forms.Form
ASKER
2 questions.
1:
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName" , GetType(System.String))
dt.Columns.Add("LastName", GetType(System.String))
Do I need to add all required columns from all tables?
2:
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
I presume I don't need this coding as my database is already complete?
1:
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName"
dt.Columns.Add("LastName",
Do I need to add all required columns from all tables?
2:
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
I presume I don't need this coding as my database is already complete?
ASKER
1:
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName" , GetType(System.String))
dt.Columns.Add("LastName", GetType(System.String))
Do I need to add all required columns from all tables?
Or just the columns I want to search on?
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName"
dt.Columns.Add("LastName",
Do I need to add all required columns from all tables?
Or just the columns I want to search on?
ASKER
Ok i've presumed that you do need to add all columns so I have done that. Left out the add items part, just get an error that FindRecord is not a member of windowsapplication3.Search
ASKER
On open the application doesnt show any data. No error just no results
ASKER
Alright quite a few useless posts ive left here. sorted a few of the errors,
Using;
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS tring
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo like '" & TxtSearch.Text & "*'"
Case Is = "BoxNumber"
sstring = "BoxNumber like '" & TxtSearch.Text & "*'"
End Select
CType(Me.Owner, Form1).FindRecords(sstring )
End Sub
Im guessin on this code, now the Name search and the matter number search works!! However when searching Boxno. get Cannot perform 'Like' operation on System.Int32 and System.String.
Please help!
Using;
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo like '" & TxtSearch.Text & "*'"
Case Is = "BoxNumber"
sstring = "BoxNumber like '" & TxtSearch.Text & "*'"
End Select
CType(Me.Owner, Form1).FindRecords(sstring
End Sub
Im guessin on this code, now the Name search and the matter number search works!! However when searching Boxno. get Cannot perform 'Like' operation on System.Int32 and System.String.
Please help!
Hi Matt, no you don't need the columns I added and filled with data, I just create a table in code, so you could test how it works without a database, I couldn't use your setup because I don't have your database.
so you don't need this part at all
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName" , GetType(System.String))
dt.Columns.Add("LastName", GetType(System.String))
Dim dr As DataRow
dr = dt.NewRow
dr.Item("ID") = 1
dr.Item("FirstName") = "John"
dr.Item("LastName") = "Do"
dt.Rows.Add(dr)
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
also
'like' only works (and is only needed) for string variables, so you need to adjust it to this
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS tring
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo = " & TxtSearch.Text
Case Is = "BoxNumber"
sstring = "BoxNumber = " & TxtSearch.Text
End Select
CType(Me.Owner, Form1).FindRecords(sstring )
End Sub
so you don't need this part at all
dt.Columns.Add("ID", GetType(System.Int32))
dt.Columns.Add("FirstName"
dt.Columns.Add("LastName",
Dim dr As DataRow
dr = dt.NewRow
dr.Item("ID") = 1
dr.Item("FirstName") = "John"
dr.Item("LastName") = "Do"
dt.Rows.Add(dr)
Dim dr2 As DataRow
dr2 = dt.NewRow
dr2.Item("ID") = 2
dr2.Item("FirstName") = "Do"
dr2.Item("LastName") = "John"
dt.Rows.Add(dr2)
also
'like' only works (and is only needed) for string variables, so you need to adjust it to this
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo = " & TxtSearch.Text
Case Is = "BoxNumber"
sstring = "BoxNumber = " & TxtSearch.Text
End Select
CType(Me.Owner, Form1).FindRecords(sstring
End Sub
Hmm is just understood that your matterno is a string var. So it should be this
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS tring
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo like '" & TxtSearch.Text & "*'"
Case Is = "BoxNumber"
sstring = "BoxNumber = " & TxtSearch.Text
End Select
CType(Me.Owner, Form1).FindRecords(sstring )
End Su
Dim sstring As String
Select Case CmbSearch.SelectedItem.ToS
Case Is = "Name"
sstring = "ClientName like '" & TxtSearch.Text & "*'"
Case Is = "MatterNumber"
sstring = "MatterNo like '" & TxtSearch.Text & "*'"
Case Is = "BoxNumber"
sstring = "BoxNumber = " & TxtSearch.Text
End Select
CType(Me.Owner, Form1).FindRecords(sstring
End Su
ASKER
Thanks Ronald, worked a treat.
ASKER
could I get your help on another thing please. My only problem is that the combo boxes dont work. Using this coding;
'Load Originating Location Combo
CmbLocation.DataSource = dv
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A dd("select edvalue", dv, "LocationID")
It accesses the database really slow taking around 5 mins to get to load up the data? Do you know a way around this, or another way or just a way of getting textboxes to display the data?
'Load Originating Location Combo
CmbLocation.DataSource = dv
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A
It accesses the database really slow taking around 5 mins to get to load up the data? Do you know a way around this, or another way or just a way of getting textboxes to display the data?
Hi matt, doesn't it work or it works but just really slow ?
Could you show the code you have now (just where you load the data, I think i still have the rest :-))
Could you show the code you have now (just where you load the data, I think i still have the rest :-))
ASKER
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Try
DA.Fill(dt)
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
dv = dt.DefaultView
cm = CType(Me.BindingContext(dv ), CurrencyManager)
'Bind Textboxes
TxtClient.DataBindings.Add ("Text", dv, "ClientName")
TxtMatterNumber.DataBindin gs.Add("Te xt", dv, "MatterNo")
TxtCloseDate.DataBindings. Add("Text" , dv, "CloseDate")
TxtNotes.DataBindings.Add( "Text", dv, "Notes")
TxtBox.DataBindings.Add("T ext", dv, "BoxNumber")
TxtDateIn.DataBindings.Add ("Text", dv, "DateIn")
TxtStoreDate.DataBindings. Add("Text" , dv, "StoreDate")
TxtDateRemoved.DataBinding s.Add("Tex t", dv, "RemoveDate")
TxtDestroyDate.DataBinding s.Add("Tex t", dv, "DestroyDate")
'Load Originating Location Combo
'CmbLocation.DataSource = DataSet11
'CmbLocation.DisplayMember = "LocationName"
'CmbLocation.ValueMember = "LocationID"
'CmbLocation.DataBindings. Add("selec tedvalue", DataSet11, "Main.LocationID")
'Load FeeEarner ComboBox
'CmbFeeEarner.DataSource = DataSet11
'CmbFeeEarner.DisplayMembe r = "FeeEarnerName"
'CmbFeeEarner.ValueMember = "FeeEarnerID"
'CmbFeeEarner.DataBindings .Add("sele ctedvalue" , DataSet11, "Main.FeeEarnerID")
'Load MatterType Combobox
'CmbMatter.DataSource = DataSet11
'CmbMatter.DisplayMember = "MatterTypeName"
'CmbMatter.ValueMember = "MatterTypeID"
'CmbMatter.DataBindings.Ad d("selecte dvalue", DataSet11, "Main.MatterTypeID")
'Load Status Combobox
'CmbStatus.DataSource = DataSet11
'CmbStatus.DisplayMember = "StorageName"
'CmbStatus.ValueMember = "StatusID"
'CmbStatus.DataBindings.Ad d("selecte dvalue", DataSet11, "Main.StatusID")
'Load Office Combobox
'CmbOffice.DataSource = DataSet11
'CmbOffice.DisplayMember = "OfficeName"
'CmbOffice.ValueMember = "OfficeID"
'CmbOffice.DataBindings.Ad d("selecte dvalue", DataSet11, "Main.OfficeID")
End Sub
I have comented out the combo boxes as the access is so slow.
It does work eventually just acceses the data really slow
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Try
DA.Fill(dt)
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
dv = dt.DefaultView
cm = CType(Me.BindingContext(dv
'Bind Textboxes
TxtClient.DataBindings.Add
TxtMatterNumber.DataBindin
TxtCloseDate.DataBindings.
TxtNotes.DataBindings.Add(
TxtBox.DataBindings.Add("T
TxtDateIn.DataBindings.Add
TxtStoreDate.DataBindings.
TxtDateRemoved.DataBinding
TxtDestroyDate.DataBinding
'Load Originating Location Combo
'CmbLocation.DataSource = DataSet11
'CmbLocation.DisplayMember
'CmbLocation.ValueMember = "LocationID"
'CmbLocation.DataBindings.
'Load FeeEarner ComboBox
'CmbFeeEarner.DataSource = DataSet11
'CmbFeeEarner.DisplayMembe
'CmbFeeEarner.ValueMember = "FeeEarnerID"
'CmbFeeEarner.DataBindings
'Load MatterType Combobox
'CmbMatter.DataSource = DataSet11
'CmbMatter.DisplayMember = "MatterTypeName"
'CmbMatter.ValueMember = "MatterTypeID"
'CmbMatter.DataBindings.Ad
'Load Status Combobox
'CmbStatus.DataSource = DataSet11
'CmbStatus.DisplayMember = "StorageName"
'CmbStatus.ValueMember = "StatusID"
'CmbStatus.DataBindings.Ad
'Load Office Combobox
'CmbOffice.DataSource = DataSet11
'CmbOffice.DisplayMember = "OfficeName"
'CmbOffice.ValueMember = "OfficeID"
'CmbOffice.DataBindings.Ad
End Sub
I have comented out the combo boxes as the access is so slow.
It does work eventually just acceses the data really slow
Well, you connect the combobox directly to the complete dataset, try it to the individual table instead, like
'Load Originating Location Combo
CmbLocation.DataSource = DataSet11.tables("location s")
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A dd("select edvalue", DataSet11, "Main.LocationID")
(also for the rest of the comboboxes ofcourse :-))
'Load Originating Location Combo
CmbLocation.DataSource = DataSet11.tables("location
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A
(also for the rest of the comboboxes ofcourse :-))
ASKER
When I use that coding the comboboxes arent populated by anything.
Any ideas\?
Any ideas\?
ASKER
Failing using comboboxes is it possible to achieve the same outcome using textboxes as the user has no need to select from the comboboxes
Are you actually filling the locations table, In your other post I don't see you doing that
ASKER
I dont think so (help?!)
ASKER
just to help;
Dim dt As New DataTable
Public dv As DataView
Dim cm As CurrencyManager
Dim CurrentRecord As Integer
Dim Constr As String = "Provider=Microsoft.Jet.OL EDB.4.0;Da ta Source=C:\Documents and Settings\Matt\Desktop\File Tracker.mdb;Persist Security Info=False"
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Try
DA.Fill(dt)
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
dv = dt.DefaultView
cm = CType(Me.BindingContext(dv ), CurrencyManager)
'Bind Textboxes
TxtClient.DataBindings.Add ("Text", dv, "ClientName")
TxtMatterNumber.DataBindin gs.Add("Te xt", dv, "MatterNo")
TxtCloseDate.DataBindings. Add("Text" , dv, "CloseDate")
TxtNotes.DataBindings.Add( "Text", dv, "Notes")
TxtBox.DataBindings.Add("T ext", dv, "BoxNumber")
TxtDateIn.DataBindings.Add ("Text", dv, "DateIn")
TxtStoreDate.DataBindings. Add("Text" , dv, "StoreDate")
TxtDateRemoved.DataBinding s.Add("Tex t", dv, "RemoveDate")
TxtDestroyDate.DataBinding s.Add("Tex t", dv, "DestroyDate")
'Load Originating Location Combo
CmbLocation.DataSource = DataSet11.Tables("Location s")
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A dd("select edvalue", DataSet11, "Main.LocationID")
'Load FeeEarner ComboBox
CmbFeeEarner.DataSource = DataSet11.Tables("FeeEarne r")
CmbFeeEarner.DisplayMember = "FeeEarnerName"
CmbFeeEarner.ValueMember = "FeeEarnerID"
CmbFeeEarner.DataBindings. Add("selec tedvalue", DataSet11, "Main.FeeEarnerID")
'Load MatterType Combobox
CmbMatter.DataSource = DataSet11.Tables("Matter")
CmbMatter.DisplayMember = "MatterTypeName"
CmbMatter.ValueMember = "MatterTypeID"
CmbMatter.DataBindings.Add ("selected value", DataSet11, "Main.MatterTypeID")
'Load Status Combobox
CmbStatus.DataSource = DataSet11.Tables("Status")
CmbStatus.DisplayMember = "StorageName"
CmbStatus.ValueMember = "StatusID"
CmbStatus.DataBindings.Add ("selected value", DataSet11, "Main.StatusID")
'Load Office Combobox
CmbOffice.DataSource = DataSet11.Tables("Offices" )
CmbOffice.DisplayMember = "OfficeName"
CmbOffice.ValueMember = "OfficeID"
CmbOffice.DataBindings.Add ("selected value", DataSet11, "Main.OfficeID")
End Sub
Public Sub FindRecords(ByVal SearchPattern As String)
Try
dv.RowFilter = SearchPattern
Catch
MsgBox("You have entered an incorrect search. Please try again.")
dv.RowFilter = ""
End Try
End Sub
Dim dt As New DataTable
Public dv As DataView
Dim cm As CurrencyManager
Dim CurrentRecord As Integer
Dim Constr As String = "Provider=Microsoft.Jet.OL
Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim DA As New OleDbDataAdapter("Select * From Main", Constr)
Try
DA.Fill(dt)
Catch Ex As Exception
MsgBox(Ex.Message)
End Try
dv = dt.DefaultView
cm = CType(Me.BindingContext(dv
'Bind Textboxes
TxtClient.DataBindings.Add
TxtMatterNumber.DataBindin
TxtCloseDate.DataBindings.
TxtNotes.DataBindings.Add(
TxtBox.DataBindings.Add("T
TxtDateIn.DataBindings.Add
TxtStoreDate.DataBindings.
TxtDateRemoved.DataBinding
TxtDestroyDate.DataBinding
'Load Originating Location Combo
CmbLocation.DataSource = DataSet11.Tables("Location
CmbLocation.DisplayMember = "LocationName"
CmbLocation.ValueMember = "LocationID"
CmbLocation.DataBindings.A
'Load FeeEarner ComboBox
CmbFeeEarner.DataSource = DataSet11.Tables("FeeEarne
CmbFeeEarner.DisplayMember
CmbFeeEarner.ValueMember = "FeeEarnerID"
CmbFeeEarner.DataBindings.
'Load MatterType Combobox
CmbMatter.DataSource = DataSet11.Tables("Matter")
CmbMatter.DisplayMember = "MatterTypeName"
CmbMatter.ValueMember = "MatterTypeID"
CmbMatter.DataBindings.Add
'Load Status Combobox
CmbStatus.DataSource = DataSet11.Tables("Status")
CmbStatus.DisplayMember = "StorageName"
CmbStatus.ValueMember = "StatusID"
CmbStatus.DataBindings.Add
'Load Office Combobox
CmbOffice.DataSource = DataSet11.Tables("Offices"
CmbOffice.DisplayMember = "OfficeName"
CmbOffice.ValueMember = "OfficeID"
CmbOffice.DataBindings.Add
End Sub
Public Sub FindRecords(ByVal SearchPattern As String)
Try
dv.RowFilter = SearchPattern
Catch
MsgBox("You have entered an incorrect search. Please try again.")
dv.RowFilter = ""
End Try
End Sub
I've tried to answer it in your other post :-)
http://www.microsoft.com/downloads/details.aspx?FamilyId=08E3D5F8-033D-420B-A3B1-3074505C03F3&displaylang=en