Subject Problem with TIB_QUERY.LOCATE
Author maralex1949
Hi:

I have a application that I converted from Access. In the access
version the user can enter a student ID and I locate the student as
follows:

If qrStudents.Locate('StudentID',Entered Student ID,[]) Then
Begin
....
End
Else
Begin
....
End;

This works fine. In the IBO version here is the problem:

If a invalid StudentID is entered the Else is executed and all is
well. If a valid student ID is entered the databound edits on the
form change showing that the record has changed per the locate but the
code for a successful locate is never executed. To illiminate the
possibility that it was something else in my application I extracted
this code and have a program with only a databound grid and a button
that executes the locate code when pressed.

The code is as follows:

If qrStudents.Locate('StudentID',1,[]) Then
Begin
Button1.Caption := 'Located';
Beep;
End
Else
Begin
Button1.Caption := 'Falied';
Beep;
End;

If I enter a 1, which is a valid student ID the locate is successful,
the databound grid pointer changes to student id 1 but the button
caption and beep never happen. If a change the number to 100, which
is a invalid Student ID, the grid does not change but the button
caption and beep happen.

Can anyone explain this?

Thanks Geno