Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ADDING LOOKUP PROGRAMMATICALLY

Status
Not open for further replies.

hbez

Instructor
Mar 25, 2003
49
ZA
I have an ADOQuery qry1 which gets its ConnectionString programmatically. I need to add a Lookup field but, when I double-click the query, Delphi (7) complains there is no ConnectionString. So I need to code in the new field. I get as far as - I hope that's correct -

<code>
qry1.FieldList.Add('MyNewField');
with qryElect.FieldByName('MyNewField') do
begin
DataSet := qry1;
KeyFields := 'Affiliation'; ...
</code>

but then get stuck with defining the ListSource, ListField and DataField.

Much appreciate any help here with my edification.
Hannes
 
don't use lookup on ADOQuery objects.
change your query instead.

/Daddy

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Many thkx for the reply, however, I use qry1 to populate a dbgrid from table1, I then need an extra (lookup) field to qry1 that will get its data from Table2 and display it as a dropdown box in a cell of the dbgrid. Hope my explanation makes sense?
Hannes
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top