Solved

Still Having a problem with look up

Posted on 1997-04-16
1
462 Views
Last Modified: 2012-06-27
I have three files. The first is called IngredientCategories.  It contains to fields.  
1. ING_CAT 40 C
2. ING_SUB 40 C

My Second file is called IngredientInformation it contains
1. ING_CAT 40 C (To Enable a master detail form)
2. ING_NAME 30 C
3. ING_MSRE 2 C

My Third is called IngredientMeasures it contains
1. ING_MSRE 2 C

I wish to read from this and do a lookup on a grid.  I wish to use The ING_MSRE from the second file to read from the third.  How is this done?  It just won't work for me.
Thanks.
0
Comment
Question by:Andrew Harrison
1 Comment
 

Accepted Solution

by:
nicsom earned 20 total points
ID: 1335419
For this kind of functionality I always use the Info Power Tools by Woll2Woll software.
You kan find a free trial version on HTTP://SUNSITE.ICM.EDU.PL/DELPHI/

It is completely native Delphi and has improved or new components for :
- Datasource
- Table
- DBGrid
- SQL-Query
- QBE-Query (paradox-based)
- KeyCombo
- Incremental search
- Search Dialog
- Locate Dialog
- Memo Dialog
- DbComboBox
- DbComboDlg
- DbLookupCombo
- DbLookupComboDlg
- DbLookupDlg (This is the one you'll need)

But if you've seen these components, you won't use the native Delphi TDataSource
and TTable-components...

Finally an example of how you should use the wwDbLookUpDlg-component.

The DoubleClick-method of your DBGrid containing the IngredientInformation:

procedure TfrmIngredient.grdIngredientDblClick(Sender: TObject);
begin
     {Determine whether you've double clicked on the ING_MSRE field}
     if grdIngredient.SelectedField = tblIngredientInfoIngMsre then
     begin
        {This is the TwwLookupDialog-component from the Info Power Tools}
        with luIngMsre do
        begin
           {Reset the index of the lookuptable to the primary key}
           LookupTable.indexname:= '';
           {Move to the record containing the measure}
           {that is currently in the ING_MSRE field in the DbGrid}
           LookupTable.wwFindKey([tblIngredientInfoIngMsre.asString]);
           {Execute the TwwLookupDialog, it returns TRUE if you selected a value}
           if execute then
           begin
              {Bring the IngredientInfo table in EDIT mode}
              tblIngredientInfo.Edit;
              {Assign the returned value to the ING_MSRE-field}
              tblIngredientInfoIngMsre.asString := LookupTable.fieldByName('Ing_Msre').asString;
           end;
           {Make sure that the cursor stays on the ING_MSRE-field;
           grdIngredient.SelectedField := tblIngredientInfoIngMsre;
        end;
     end;
end;
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now