Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

access .findfirst method syntax

Posted on 2014-09-15
3
Medium Priority
?
286 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 2000 total points
ID: 40322833
Try with changing line 12 as below:

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

Expert Comment

by:Ramkisan Jagtap
ID: 40322839
0
 

Author Closing Comment

by:PeterBaileyUk
ID: 40322857
thank you all working
0

Featured Post

NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

Question has a verified solution.

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

Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
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 different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

824 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