Still Problem with Dataview.Find

  • Thread starter Thread starter Charles A. Lackman
  • Start date Start date
C

Charles A. Lackman

Hello,

When I Do Desc, It works but everything is backwards. All the records go
from Z - A. I need them to go from A - Z and grab the first one it finds.

ASC reproduces the behaviour stated below:

I am retrieving data from a database "Order By LastName", when I use a
dataview to find a Last Name it does not give me the first instance of the
Last Name.

ie.

ADataView.Sort = "LastName"
AnInteger=ADataView.find("Smith")
BindingContext(ADataView).Position = AnInteger

If there are more than one "Smith" in the database it goes to the second
one instead of the First one.

What I need is for it to go to the first one.

Any suggestions will be greatly appreciated.


Thanks,
Chuck
 
It there is three, does it still go to the last one? Just checking for
"off-by-one" errors.

Also, there is no concept of "first" or "last" in set logic when you return
multiple. How are YOU determining first? Physical ordering in the table?
Bad....

Perhaps try adding order by lastname, firstname?

Jeff
 
Hello,

When I sort by LastName and FirstName I have to send an array to the Find
Method,
If I do not know what the First Name is it does not return anything.

Any suggestions??
Chuck
 
I had asked 3 questions

Charles A. Lackman said:
Hello,

When I sort by LastName and FirstName I have to send an array to the Find
Method,
If I do not know what the First Name is it does not return anything.

Any suggestions??
Chuck
 
Hello,

Question 1,

Yes if there are three it goes to the second record (not the last one). It
is an Off-by-one error.

Question 2,

Yes I am determining the first based on the physical ordering in the table.
It does not really matter at this point what order they are in.

Question 3,

The First Name is not known. Therefore I cannot sort by both because the
find method then requires an array with both the Last Name and First Name.
If I make the First Name equal to Nothing or "" then -1 is returned as the
index.

Chuck
 
Um, so I assumed you considered that the position may be zero-based? Can't
you just subtract one from AnInteger??

Jeff
 
Back
Top