Solved

Still Having a problem with look up

Posted on 1997-04-16
1
461 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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

743 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

16 Experts available now in Live!

Get 1:1 Help Now