Technical Information Database TI1285D.txt - How to Create a TDBGrid Lookup Field in 32-bit Delphi Category :Database Programming Platform :All-32Bit Product :All32Bit, Description: 1. Drop 2-TTable's, 1-TDataSource and 1-TDBGrid on a form. 2. Connect Table1 to DataSource1 to DBGrid1 a. DataSource1.DataSet = Table1 b. DBGrid1.DataSource = DataSource1 3. Setup Table1 a. Table1.Database = DBDemos b. Table1.TableName = Customer c. Table1.Active = True 4. Setup Table2 a. Table2.Database = DBDemos b. Table2.TableName = Orders c. Table2.Active = True 5. Add all of the fields for Table1 by bringing up the Fields Editor: a. Double click on Table1 b. Right click on Fields Editor c. Add New Fields. Add all of them 6. Add a new field for Table1. a. Right click on Fields Editor, and select New Field. 7. Specify the following parameters for the newly added field. a. Name: Bob b. Type: String c. Size: 30 d. Select Lookup e. Key Fields: CustNo - Field in Table1 to store value f. DataSet: Table2 - Table lookup is being done on g: LookUpKeys: CustNo - This Key gets copied to KeyField h: Result Field: OrderNo - Value to display to the user in the drop down box 8. Run the application Reference: 3/30/99 12:17:42 PM
Last Modified: 01-SEP-99