I am trying to setup a Count routine that will use a wildcard to find all records in a certain field within a certain table that starts with a specified number (comes from a text box) but I don't think the wildcard is working because no matter what I enter it doesn't find a Count (always 0). Any idea what I might be doing wrong now?
thanks in advance for any help that you can give me with this.
part", OleDbType.VarChar).Value = Me.txtCurGL.Text.ToString & "%"
'Check to make sure the Current Department already exisits
Dim Count2 As Integer = 0
Using Connection As New OleDbConnection _
("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Comet 631 Databases\Converted to 2003\C022008.mdb")
Dim cmd As OleDbCommand = New OleDbCommand _
("Select Count(ActAcct) as ExistingRecords From [SHACT] where (ActAcct)= @CurrDepart", Connection)
cmd.Parameters.AddWithValue("@CurrDepart", Me.txtCurGL.Text.ToString & "%")
Count2 = CInt(cmd.ExecuteScalar)
("@CurrDepart",me.txtCurGL.text.Tostring & "%")end withconnection.open()
'if the Current Department doesn't exisit then throw message and exit sub
If Count2 <= 0 Then
MessageBox.Show("The GL Department " & Me.txtCurGL.Text.ToString & " does not exisit.", _
"Copy Department", MessageBoxButtons.OK)