findlast function is not functioning? 
Author Message
 findlast function is not functioning?

Hello All,

The below code can work when I want a first match record,
I would like to know that do I just replace the findFirst with the findLast
if I want a last match record?

strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
    Debug.Print strSearch

    Me.Requery
    Me.RecordsetClone.FindFirst strSearch
    Me.Bookmark = Me.RecordsetClone.Bookmark

ErrorHandlerExit:
    Exit Sub

ErrorHandler:
    MsgBox "Error No: " & Err.Number & ";Description: " & Err.Description
    Resume ErrorHandlerExit

For instance, if there are 2 record in the VF_Code,one is 1234 and other is
1235, If I enter a keyword 123 in the VF_CODE_combobox, should it return me
the record 1235, as the findLast function?

Pls help~!~



Tue, 26 Apr 2005 04:58:38 GMT  
 findlast function is not functioning?
Hi,
The FindLast method begins it's search from the end of the recordset.
and stops on the first match it finds.
So, if you have your recordset sorted so that 1235 is AFTER 1234,
then yes it will return 1235.

HTH
Dan Artuso, MVP


Quote:
> Hello All,

> The below code can work when I want a first match record,
> I would like to know that do I just replace the findFirst with the
findLast
> if I want a last match record?

> strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
>     Debug.Print strSearch

>     Me.Requery
>     Me.RecordsetClone.FindFirst strSearch
>     Me.Bookmark = Me.RecordsetClone.Bookmark

> ErrorHandlerExit:
>     Exit Sub

> ErrorHandler:
>     MsgBox "Error No: " & Err.Number & ";Description: " & Err.Description
>     Resume ErrorHandlerExit

> For instance, if there are 2 record in the VF_Code,one is 1234 and other
is
> 1235, If I enter a keyword 123 in the VF_CODE_combobox, should it return
me
> the record 1235, as the findLast function?

> Pls help~!~



Tue, 26 Apr 2005 07:09:46 GMT  
 findlast function is not functioning?
But I found that it will return the number 1234...

--
R ?pao?
                            From p?o


Quote:
> Hi,
> The FindLast method begins it's search from the end of the recordset.
> and stops on the first match it finds.
> So, if you have your recordset sorted so that 1235 is AFTER 1234,
> then yes it will return 1235.

> HTH
> Dan Artuso, MVP



> > Hello All,

> > The below code can work when I want a first match record,
> > I would like to know that do I just replace the findFirst with the
> findLast
> > if I want a last match record?

> > strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
> >     Debug.Print strSearch

> >     Me.Requery
> >     Me.RecordsetClone.FindFirst strSearch
> >     Me.Bookmark = Me.RecordsetClone.Bookmark

> > ErrorHandlerExit:
> >     Exit Sub

> > ErrorHandler:
> >     MsgBox "Error No: " & Err.Number & ";Description: " &
Err.Description
> >     Resume ErrorHandlerExit

> > For instance, if there are 2 record in the VF_Code,one is 1234 and other
> is
> > 1235, If I enter a keyword 123 in the VF_CODE_combobox, should it return
> me
> > the record 1235, as the findLast function?

> > Pls help~!~



Tue, 26 Apr 2005 23:21:52 GMT  
 findlast function is not functioning?
Hi,
I just re-read your first post. If you're searching on 123, then it should
return
the first record with EXACTLY 123, not 1234. I don't know why you're getting
1234. You could try a wildcard in your expression (*).
strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "*'"

HTH
Dan Artuso, MVP


Quote:
> But I found that it will return the number 1234...

> --
> R ?pao?
>                             From p?o



> > Hi,
> > The FindLast method begins it's search from the end of the recordset.
> > and stops on the first match it finds.
> > So, if you have your recordset sorted so that 1235 is AFTER 1234,
> > then yes it will return 1235.

> > HTH
> > Dan Artuso, MVP



> > > Hello All,

> > > The below code can work when I want a first match record,
> > > I would like to know that do I just replace the findFirst with the
> > findLast
> > > if I want a last match record?

> > > strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
> > >     Debug.Print strSearch

> > >     Me.Requery
> > >     Me.RecordsetClone.FindFirst strSearch
> > >     Me.Bookmark = Me.RecordsetClone.Bookmark

> > > ErrorHandlerExit:
> > >     Exit Sub

> > > ErrorHandler:
> > >     MsgBox "Error No: " & Err.Number & ";Description: " &
> Err.Description
> > >     Resume ErrorHandlerExit

> > > For instance, if there are 2 record in the VF_Code,one is 1234 and
other
> > is
> > > 1235, If I enter a keyword 123 in the VF_CODE_combobox, should it
return
> > me
> > > the record 1235, as the findLast function?

> > > Pls help~!~



Wed, 27 Apr 2005 07:04:45 GMT  
 findlast function is not functioning?
Hi,
Actually I expected that it will return a string which is the last match of
my key word if I use the
strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "'"
However, it can't work, then I use the string you wrote before,
it also can't work.


Quote:
> Hi,
> I just re-read your first post. If you're searching on 123, then it should
> return
> the first record with EXACTLY 123, not 1234. I don't know why you're
getting
> 1234. You could try a wildcard in your expression (*).
> strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "*'"

> HTH
> Dan Artuso, MVP



> > But I found that it will return the number 1234...

> > --
> > R ?pao?
> >                             From p?o



> > > Hi,
> > > The FindLast method begins it's search from the end of the recordset.
> > > and stops on the first match it finds.
> > > So, if you have your recordset sorted so that 1235 is AFTER 1234,
> > > then yes it will return 1235.

> > > HTH
> > > Dan Artuso, MVP



> > > > Hello All,

> > > > The below code can work when I want a first match record,
> > > > I would like to know that do I just replace the findFirst with the
> > > findLast
> > > > if I want a last match record?

> > > > strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
> > > >     Debug.Print strSearch

> > > >     Me.Requery
> > > >     Me.RecordsetClone.FindFirst strSearch
> > > >     Me.Bookmark = Me.RecordsetClone.Bookmark

> > > > ErrorHandlerExit:
> > > >     Exit Sub

> > > > ErrorHandler:
> > > >     MsgBox "Error No: " & Err.Number & ";Description: " &
> > Err.Description
> > > >     Resume ErrorHandlerExit

> > > > For instance, if there are 2 record in the VF_Code,one is 1234 and
> other
> > > is
> > > > 1235, If I enter a keyword 123 in the VF_CODE_combobox, should it
> return
> > > me
> > > > the record 1235, as the findLast function?

> > > > Pls help~!~



Wed, 27 Apr 2005 15:06:32 GMT  
 findlast function is not functioning?
If you do not have wildcards, there's no difference between

   strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "'"

and

   strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele


Quote:
> Hi,
> Actually I expected that it will return a string which is the last match
of
> my key word if I use the
> strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "'"
> However, it can't work, then I use the string you wrote before,
> it also can't work.



> > Hi,
> > I just re-read your first post. If you're searching on 123, then it
should
> > return
> > the first record with EXACTLY 123, not 1234. I don't know why you're
> getting
> > 1234. You could try a wildcard in your expression (*).
> > strSearch = "[VF_Code] Like '" & Me![VF_CODE] & "*'"

> > HTH
> > Dan Artuso, MVP



> > > But I found that it will return the number 1234...

> > > --
> > > R ?pao?
> > >                             From p?o



> > > > Hi,
> > > > The FindLast method begins it's search from the end of the
recordset.
> > > > and stops on the first match it finds.
> > > > So, if you have your recordset sorted so that 1235 is AFTER 1234,
> > > > then yes it will return 1235.

> > > > HTH
> > > > Dan Artuso, MVP



> > > > > Hello All,

> > > > > The below code can work when I want a first match record,
> > > > > I would like to know that do I just replace the findFirst with the
> > > > findLast
> > > > > if I want a last match record?

> > > > > strSearch = "[VF_Code] = '" & Me![VF_CODE] & "'"
> > > > >     Debug.Print strSearch

> > > > >     Me.Requery
> > > > >     Me.RecordsetClone.FindFirst strSearch
> > > > >     Me.Bookmark = Me.RecordsetClone.Bookmark

> > > > > ErrorHandlerExit:
> > > > >     Exit Sub

> > > > > ErrorHandler:
> > > > >     MsgBox "Error No: " & Err.Number & ";Description: " &
> > > Err.Description
> > > > >     Resume ErrorHandlerExit

> > > > > For instance, if there are 2 record in the VF_Code,one is 1234 and
> > other
> > > > is
> > > > > 1235, If I enter a keyword 123 in the VF_CODE_combobox, should it
> > return
> > > > me
> > > > > the record 1235, as the findLast function?

> > > > > Pls help~!~



Wed, 27 Apr 2005 20:38:10 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Function ToNumber not function?

2. Dir function not functioning correctly...

3. FindFirst, FindLast, FindPrevious, FindNext Not Working

4. Need Am I Online Function, Please Help

5. What Function am I in??????

6. Am I missing something here ...? Instr Function

7. Time function, displaying AM PM

8. What Function/Sub am I in.

9. Calling A Function (What am I doing wrong)

10. Call Function of am Modul = Error !

11. I am trying to update a record, i am not using data control

12. I am trying to update a record, i am not using data control

 

 
Powered by phpBB® Forum Software