[DUG]: TDBGrid Lookup Field

1999-09-07 Thread Patrick Dunford


Is it possible to use a column and picklist on a TDBGrid.Column to look up
values from a table?

Suppose I have a table with rows that look like this

Cat 1
Fish 2
Dog 3
Pig 4

and I have a field in a table that has a numerical field based on the
numbers shown. But when I display the field's values in the grid, I want to
display the text value, and my picklist lets someone pick the text value
when they are entering or changing the field, and they never actually see
the number. Is it possible? How do I implement it?


Patrick Dunford, Christchurch, NZ
http://patrick.dunford.com/

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



RE: [DUG]: TDBGrid Lookup Field

1999-09-07 Thread Dennis Chuah


Patrick,

The answer is YES, you can.  In your second table, go to the field editor
and add a lookup field.  Specify the key field as the field that holds the
numerical values.  Specify the first table as the dataset.  Specify the
number field of the first table as the key to lookup and lastly, specify the
data field (cat, fish, etc) ad the field to lookup.

Now, if you display the new field in the DBgrid, it will automatically
display a dropdown combobox when in edit mode.

Hope this helps.
Dennis.

 Is it possible to use a column and picklist on a
 TDBGrid.Column to look up
 values from a table?

 Suppose I have a table with rows that look like this

 Cat 1
 Fish 2
 Dog 3
 Pig 4

 and I have a field in a table that has a numerical field based on the
 numbers shown. But when I display the field's values in the
 grid, I want to
 display the text value, and my picklist lets someone pick the
 text value
 when they are entering or changing the field, and they never
 actually see
 the number. Is it possible? How do I implement it?

---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz



Re: [DUG]: TDBGrid Lookup Field

1999-09-07 Thread Neven MacEwan

Two options I can think of

1/ Get Infopower from Woll2Woll
2/ Better still normalise your db so the link is to anothe table

rgds




- Original Message -
From: Patrick Dunford [EMAIL PROTECTED]
To: Multiple recipients of list delphi [EMAIL PROTECTED]
Sent: Wednesday, 8 September 1999 07:11
Subject: [DUG]: TDBGrid Lookup Field



 Is it possible to use a column and picklist on a TDBGrid.Column to look up
 values from a table?

 Suppose I have a table with rows that look like this

 Cat 1
 Fish 2
 Dog 3
 Pig 4

 and I have a field in a table that has a numerical field based on the
 numbers shown. But when I display the field's values in the grid, I want
to
 display the text value, and my picklist lets someone pick the text value
 when they are entering or changing the field, and they never actually see
 the number. Is it possible? How do I implement it?

 
 Patrick Dunford, Christchurch, NZ
 http://patrick.dunford.com/

 --
-
 New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
   Website: http://www.delphi.org.nz


---
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
  Website: http://www.delphi.org.nz