Hi,
I've written below sub.
Public Sub Coun()
Dim cnn As Connection
Dim rs As New ADODB.Recordset
Dim r As Integer
r = Me!txtRef1
Set cnn = CurrentProject.Connection
rs.Open "tblItems", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
cnn.BeginTrans
rs.Filter = "RefNo=r"
If rs.RecordCount = 0 Then GoTo line1
rs.Delete
rs.Update
line1:
cnn.CommitTrans
End Sub
unfortunately, when I run it I receive 'RUN TIME ERROR 3001' on the statement
rs.Filter = "RefNo=r"
Do I have to use only values on the criteria string? Is there a way out to use variables as well? What's the best way to filter a recordset and determine Recordset.Recordcount?
Thanks in advance
murat
I've written below sub.
Public Sub Coun()
Dim cnn As Connection
Dim rs As New ADODB.Recordset
Dim r As Integer
r = Me!txtRef1
Set cnn = CurrentProject.Connection
rs.Open "tblItems", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
cnn.BeginTrans
rs.Filter = "RefNo=r"
If rs.RecordCount = 0 Then GoTo line1
rs.Delete
rs.Update
line1:
cnn.CommitTrans
End Sub
unfortunately, when I run it I receive 'RUN TIME ERROR 3001' on the statement
rs.Filter = "RefNo=r"
Do I have to use only values on the criteria string? Is there a way out to use variables as well? What's the best way to filter a recordset and determine Recordset.Recordcount?
Thanks in advance
murat