3251 Error

J

Joe

I have built the following code in an attempt to find
duplicate entries in a table, ("qry DupTel" is a query
showing the duplicates) I pass two string variables from
the first record (iTel and iAccounts). I then open the
second recordset and attempt to use findfirst to search
for the first record matching the criteria contained in
the variables "iTel and iAccounts". The procedure reports
an error "3251 operation not supported for this object". I
don't think I have got the quotes right within the
criteria! Any help would be appreciated.

Joe
PS. When the record is located I would like to delete the
first entry.

Private Sub Command0_Click()
Dim dbRemTel As DAO.Database
Dim rcdRemTelNum As DAO.Recordset
Set dbRemTel = CurrentDb
Set rcdRemTelNum = dbRemTel.OpenRecordset("qryDupTel")

Dim iTel As String
Dim iCount As Variant
Dim iAccounts As String

rcdRemTelNum.MoveFirst
If Not (rcdRemTelNum.EOF) Then
rcdRemTelNum.MoveFirst
iTel = rcdRemTelNum![phonenum Field]
iAccounts = rcdRemTelNum![code field]
rcdRemTelNum.Close

Dim dbdeleteTel As DAO.Database
Dim rcdDelTel As DAO.Recordset
Set dbdeleteTel = CurrentDb
Set rcdDelTel = dbdeleteTel.OpenRecordset("camphone")


rcdDelTel.FindFirst "[phonenum] = """ & iTel & "
And "
Code:
 ="" & iAccounts"""
 
T

Terry

Spot the single quotes Joe,
Regards

rcdDelTel.FindFirst "[phonenum] = '" & iTel & "' And
Code:
 = '" & iAccounts
& "'"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

populate listbox form database table 0
FindFirst Method 3
VBA works in orignal but fails in copy of database 1
Runtime error 3251 5
FindFirst 3251 4
Ranking records 1
FindFirst 3
Currenct issue with a text box 1

Top