Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Still Having a problem with look up

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 115
How to load 2 images in same column in Delphi 2 57
Delphi problems to abort a printjob 9 24
Browsing a TTreeView in Delphi 5 7
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

840 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