Solved

Access runtime  error 3251 operation not supported

Posted on 2010-11-30
5
2,920 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
This article describes how to import an Outlook PST file to Office 365 using a third party product to avoid Microsoft's Azure command line tool, saving you time.
Learn how to make your own table of contents in Microsoft Word using paragraph styles and the automatic table of contents tool. We'll be using the paragraph styles in Word’s Home toolbar to help you create a table of contents. Type out your initial …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

687 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