Challenge: Locating Records

In part of my program, I am trying to locate a record.  The main
customer form calls another form as ShowModal using the following code:

   CusIndex := DataModule1.Custab.IndexName;
   Schedule.InitialCust :=
DataModule1.Custab.FieldByName('IDNUM').AsInteger;
   Schedule.IgnoreActivate := False;
   Schedule.ShowModal;
   Schedule.Close;

When the schedule form is activated, the FormActivate event is called,
which containse the following code:

         DataModule1.Custab.DisableControls;
         DataModule1.Custab.Filtered := False;
         DataModule1.Custab.Filter := '';
         DataModule1.Custab.IndexName := 'LOCATION';
         DataModule1.Custab.EnableControls;

         MouseGrid1.SetFocus;
         IgnoreActivate := True;
         DataModule1.Custab.Refresh;
         DataModule1.Custab.Locate('IDNUM', Integer(InitialCust), []);
         QueryFilter1.Checked := DataModule1.Custab.Filtered;

The problem is, no matter what I try, when the "Locate" line is called
from the FormActivate, I get the message:

         Project WINLTD.exe raised exception class EDBEngineError with
         message 'No current record'.  Process stopped. Use Step or Run
         to continue.

If anybody at all can help me, please send me an e-mail and/or post a
reply.  I really do appreciate any help you can give!!

Thanks in advance,

Ralph
Wise Software, Programmer/Analyst
mailto:ra...@poolspa.com