J
jstroup
I've got a form that I'm using to call a routine which will query a table
(tblWorkOrders) for the number of records matching a certain type (stTemp).
My code is as follows:
Private Function QueryWorkOrders(ByVal stTemp As String)
On Error GoTo Form_AfterUpdate_Err
Dim con As Object
Dim rs As New ADODB.Recordset
Dim stSql As String
stSql = "SELECT [tblWorkOrders.wo] FROM [tblWorkOrders]"
stSql = stSql & " WHERE [tblWorkOrders.wo] Like ""*" & stTemp & "*;"""
rs.Open stSql, CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
QueryWorkOrders = rs.RecordCount
Exit Function
Form_AfterUpdate_Err:
MsgBox "Error is " & Err.Description
End Function
Every time I get a returned value of -1. I've used Message Boxes to verify
my SQL string and compared it to a stored query which works just fine.
Any help would be greatly appreciated.
jason
(tblWorkOrders) for the number of records matching a certain type (stTemp).
My code is as follows:
Private Function QueryWorkOrders(ByVal stTemp As String)
On Error GoTo Form_AfterUpdate_Err
Dim con As Object
Dim rs As New ADODB.Recordset
Dim stSql As String
stSql = "SELECT [tblWorkOrders.wo] FROM [tblWorkOrders]"
stSql = stSql & " WHERE [tblWorkOrders.wo] Like ""*" & stTemp & "*;"""
rs.Open stSql, CurrentProject.Connection, adOpenDynamic,
adLockOptimistic
QueryWorkOrders = rs.RecordCount
Exit Function
Form_AfterUpdate_Err:
MsgBox "Error is " & Err.Description
End Function
Every time I get a returned value of -1. I've used Message Boxes to verify
my SQL string and compared it to a stored query which works just fine.
Any help would be greatly appreciated.
jason