Solved

Still Having a problem with look up

Posted on 1997-04-16
1
465 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
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.
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

770 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