Solved

Access runtime  error 3251 operation not supported

Posted on 2010-11-30
5
2,756 Views
Last Modified: 2012-05-10
WindowsXP, Access 2003, novice user.

I have an unbound form.

I've written my code as follows:

Private Sub txtUniqueName_AfterUpdate()
    Dim rst As DAO.Recordset
    Set rst = CurrentDb.OpenRecordset("hstUser")
    rst.FindFirst "[UniqueName] = " & Me.txtUniqueName
    If rst.NoMatch Then
      MsgBox "No match found on file", vbOKOnly
    Else
      MsgBox "Unique Name already on file", vbOKOnly
    End If
    Set rst = Nothing
End Sub

My problem is when I tab out of the text box I get the error msg

RUNTIME ERROR 3251 OPERATION IS NOT SUPPORTED FOR THIS TYPE OF OBJECT

the line
rst.FindFirst "[UniqueName] = " & Me.txtUniqueName is highlighted when i click on debug.

I do not know if I am getting this error because my form is unbound and maybe after_update is not the appropriate event or if there is something else I am doing wrong.

Thanks in advance for assistance.

Misty

0
Comment
Question by:mreid3847
  • 2
  • 2
5 Comments
 
LVL 7

Assisted Solution

by:RemRemRem
RemRemRem earned 25 total points
ID: 34241520
If it's a text value, you may need the addition of single quotes around the value:

  rst.FindFirst "[UniqueName] = '" & Me.txtUniqueName & "'"

-R
0
 

Author Comment

by:mreid3847
ID: 34241607
Thanks Rem I tried the suggestion and I get the same runtime error.
0
 
LVL 8

Accepted Solution

by:
pdd1lan earned 475 total points
ID: 34241719
Dim rst As DAO.Recordset
    Set rst = CurrentDb.OpenRecordset("hstUser",dbOpenDynaset)
    rst.FindFirst "[UniqueName] = '" & Me.txtUniqueName & "'"
    If rst.NoMatch Then
      MsgBox "No match found on file", vbOKOnly
    Else
      MsgBox "Unique Name already on file", vbOKOnly
    End If
    Set rst = Nothing
End Sub

0
 
LVL 8

Expert Comment

by:pdd1lan
ID: 34241813
as above code, I tested it, and it seems working.

you need to add dbOpenDynaset in  this line Set rst = CurrentDb.OpenRecordset("hstUser",dbOpenDynaset)

and change this line to    rst.FindFirst "[UniqueName] = '" & Me.txtUniqueName & "'"
0
 

Author Closing Comment

by:mreid3847
ID: 34241860
Thanks to you both, the solution provided did work when I tested it on my form.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Excess tables to Excel BackUp 3 29
linked subforms are yielding error:  ... (800110108) 3 16
Access 2010 Query Syntax 5 23
Running Total in Access 4 17
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now