Solved

access .findfirst method syntax

Posted on 2014-09-15
3
270 Views
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
        .MoveFirst
        
        .FindFirst "[sDesc] = '" & WordArray(Index) & "'"
          If .NoMatch Then
          'do nothing
          Else
            WordArray(Index) = .Fields("sClientDescGroup").Value
          
          End If
    
    End With
    
Next

Index = 0

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

If Index = 0 Then

    StrOutput = WordArray(Index)

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


ApplyAlias = StrOutput





End Function

Open in new window

0
Comment
Question by:PeterBaileyUk
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
Ramkisan Jagtap earned 500 total points
Comment Utility
Try with changing line 12 as below:

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

Expert Comment

by:Ramkisan Jagtap
Comment Utility
0
 

Author Closing Comment

by:PeterBaileyUk
Comment Utility
thank you all working
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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.

771 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

12 Experts available now in Live!

Get 1:1 Help Now