Solved

Access runtime  error 3251 operation not supported

Posted on 2010-11-30
5
2,698 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
Comment Utility
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
Comment Utility
Thanks Rem I tried the suggestion and I get the same runtime error.
0
 
LVL 8

Accepted Solution

by:
pdd1lan earned 475 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks to you both, the solution provided did work when I tested it on my form.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will show you how to use shortcut menus in the Access run-time environment.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
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, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

744 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

16 Experts available now in Live!

Get 1:1 Help Now