access .findfirst method syntax

Posted on 2014-09-15
Medium Priority
Last Modified: 2014-09-15
I have a .findfirst method in my function but it squeels error 3251 op is not supported

not sure how to correct.

Public Function ApplyAlias(Strin As String) As String

Dim Db As DAO.Database
Set Db = CurrentDb()
Dim rstTclient As DAO.Recordset
Dim StrOutput As String
Dim Index As Integer

Dim WordArray() As String
WordArray() = Split(Trim(Strin), " ")
Set rstTclient = Db.OpenRecordset("TblModelAlias")

For Index = LBound(WordArray) To UBound(WordArray)

    With rstTclient
        .FindFirst "[sDesc] = '" & WordArray(Index) & "'"
          If .NoMatch Then
          'do nothing
            WordArray(Index) = .Fields("sClientDescGroup").Value
          End If
    End With

Index = 0

For Index = LBound(WordArray) To UBound(WordArray)

If Index = 0 Then

    StrOutput = WordArray(Index)

    StrOutput = StrOutput & " " & WordArray(Index)
End If

ApplyAlias = StrOutput

End Function

Open in new window

Question by:PeterBaileyUk
  • 2
LVL 12

Accepted Solution

Ramkisan Jagtap earned 2000 total points
ID: 40322833
Try with changing line 12 as below:

Set rstTclient = Db.OpenRecordset("TblModelAlias", dbOpenDynaset)

Author Closing Comment

ID: 40322857
thank you all working

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
If you’re using QODBC to update QuickBooks data from Microsoft® Access but Access is not showing the updated data, you could have set up QODBC incorrectly.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

627 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