Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: FDTQuery.Locate



Permlink Replies: 2 - Last Post: Jan 30, 2016 2:47 PM Last Post By: Jim Sawyer
Jim Sawyer

Posts: 214
Registered: 1/3/10
FDTQuery.Locate
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 30, 2016 9:13 AM
I hope I can explain my problem so it is clear.

I have a FDTQuery1 with IndexFieldNames set to 'City;State;Zip' (three field names).
When I open the form, I want the FDTQuery1 to automatically advance to default fields;
I have FDTPuery2 with three fields (DefCity, DefState, and DefZipcide ); I have in the form's
OnShow event the statement

FDTQuery1.Locate( FDTQuery2.FieldByName('DefCity').AsString + FDTQuery2.FieldByName('DefState').AsString + FDTQuery2.FieldByName('DefZipcode').AsString, loCaseInsensitive );

When it executes the statement, it has an error that it can't find 'FORT WORTHTX76543';

Those are the default city, state, and zip values (albeit all smushed together).

Any ideas?

Thanks,
Jim Sawyer
Jeff Overcash (...

Posts: 1,529
Registered: 9/23/99
Re: FDTQuery.Locate
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 30, 2016 11:51 AM   in response to: Jim Sawyer in response to: Jim Sawyer
Jim Sawyer wrote:
I hope I can explain my problem so it is clear.

I have a FDTQuery1 with IndexFieldNames set to 'City;State;Zip' (three field names).
When I open the form, I want the FDTQuery1 to automatically advance to default fields;
I have FDTPuery2 with three fields (DefCity, DefState, and DefZipcide ); I have in the form's
OnShow event the statement

FDTQuery1.Locate( FDTQuery2.FieldByName('DefCity').AsString + FDTQuery2.FieldByName('DefState').AsString + FDTQuery2.FieldByName('DefZipcode').AsString, loCaseInsensitive );

When it executes the statement, it has an error that it can't find 'FORT WORTHTX76543';

Those are the default city, state, and zip values (albeit all smushed together).

Any ideas?

Thanks,
Jim Sawyer

Locate expects a VarAarry of each element, not the three elements combined.

FDTQuery1.Locate('City;State;Zip',
VarArrayOf(FDTQuery2.FieldByName('DefCity').AsString,
FDTQuery2.FieldByName('DefState').AsString,
FDTQuery2.FieldByName('DefZipcode').AsString),
loCaseInsensitive);

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Jim Sawyer

Posts: 214
Registered: 1/3/10
Re: FDTQuery.Locate
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 30, 2016 2:47 PM   in response to: Jeff Overcash (... in response to: Jeff Overcash (...
Thanks. Working now..

Jeff Overcash (TeamB) wrote:
Jim Sawyer wrote:
I hope I can explain my problem so it is clear.

I have a FDTQuery1 with IndexFieldNames set to 'City;State;Zip' (three field names).
When I open the form, I want the FDTQuery1 to automatically advance to default fields;
I have FDTPuery2 with three fields (DefCity, DefState, and DefZipcide ); I have in the form's
OnShow event the statement

FDTQuery1.Locate( FDTQuery2.FieldByName('DefCity').AsString + FDTQuery2.FieldByName('DefState').AsString + FDTQuery2.FieldByName('DefZipcode').AsString, loCaseInsensitive );

When it executes the statement, it has an error that it can't find 'FORT WORTHTX76543';

Those are the default city, state, and zip values (albeit all smushed together).

Any ideas?

Thanks,
Jim Sawyer

Locate expects a VarAarry of each element, not the three elements combined.

FDTQuery1.Locate('City;State;Zip',
VarArrayOf(FDTQuery2.FieldByName('DefCity').AsString,
FDTQuery2.FieldByName('DefState').AsString,
FDTQuery2.FieldByName('DefZipcode').AsString),
loCaseInsensitive);

--
Jeff Overcash (TeamB)
(Please do not email me directly unless asked. Thank You)
Learning is finding out what you already know. Doing is demonstrating that you
know it. Teaching is reminding others that they know it as well as you. We are
all leaners, doers, teachers. (R Bach)

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02