Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Still Having a problem with look up

Posted on 1997-04-16
1
Medium Priority
?
482 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
[X]
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
1 Comment
 

Accepted Solution

by:
nicsom earned 60 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Suggested Courses

705 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