Run-time error '3251'

G

Guest

I am getting this error message at the FindFirst call in the following code.
Run-time error '3251':
Operation is not supported for this type of object.

Sub FillOneLCdetails(lcID As Long)

Dim rstTSV As DAO.Recordset
Dim strSQL As String

Set rstTSV = CurrentDb.OpenRecordset("LaneChangeDetails")

If rstTSV.EOF = False Then
strSQL = "[ID] = " & lcID
rstTSV.FindFirst strSQL
If rstTSV.NoMatch Then
MsgBox "No records found with " & strSQL
End If
'..... etc .....


MS DAO 3.6 Object Library is checked in Available References

Can someone tell me what's wrong?
(The strange thing is that the same code was working last year, I don't
understand...)

Thanks
 
B

Brendan Reynolds

If 'LaneChangeDetails' is a local (not linked) table, then you'll need to
specify the recordset type ...

Set rstTSV = CurrentDb.OpenRecordset("LaneChangeDetails", dbOpenDynaset)

The default for local tables is dbOpenTable, which results in a recordset
that does not support FindFirst. The default for linked tables and for
queries is dbOpenDynaset, which may explain why similar code has worked for
you before.
 

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

FindFirst Method 3
Type mismatch and reference 2
can't open recordset 2
Issue with Linked Table 1
Error 3141 Cannot resolve 3
Run time error 2
newbie problem with libraries and syntax 2
Run-Time Error '2107' 10

Top