Solved

Access runtime  error 3251 operation not supported

Posted on 2010-11-30
5
2,791 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
My experience with Windows 10 over a one year period and suggestions for smooth operation
The viewer will learn how to use the =DISCRINV command to create a discrete random variable, use this command to model a set of probabilities and outcomes in a Monte Carlo simulation, and learn how to find the standard deviation of a set of probabil…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …

809 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