Solved

Refresh Of Lookup List on DBGrid

Posted on 2002-04-02
9
1,229 Views
Last Modified: 2010-05-18
Hi
Wonder if any of u can help.

I am working on D5 Enterprise, using ADO components to connect and manipulate an Access 2000 database.

Setup is as follows:
FormA has DBGrid with datasource, adoconnection, adotable components looking at an Access table.

FormB has DBGrid with datasource, adoconnection, adotable components looking at the related table.

One of the fields is a foreign key to another table, so I set up a lookup list using a calculated lookup field. I set the app up so that if the user currently has focus on this lookup field on FormA, then by pressing a command button they call another form (FormB) to edit the contents of the related table. When the user closes this form they are taken back to FormA and the dbgrid should update to reflect the users changes -- the problem is its not updating. It does if I close the app and re open it, but this is obviously not what I want. I've tried refreshes, requerys, closing the connection and reopening it, all fail. Am I:

a) not attacking this in the correct way,
b) addressing a bug,
c) missing something

any ideas please.


Regards
Cardiod
0
Comment
Question by:cardiod
  • 3
  • 2
  • 2
  • +1
9 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 50 total points
Comment Utility
simple

adotable.requery;

a sample from one of my current project
(also ado, also access)
if the gridcolumn (uses quantumgrid of devexpress)
is clicked,
a lookupsource, editwindow come up

procedure TfrmFlyTime.dbgZDetailColumnClick(Sender: TObject; Column: TdxDBTreeListColumn);
begin
  If Column.Field.FieldName = 'ZEITEN_TYPLookUp' then
    with tfrmZeitTyp.Create(Self) do
    try
      tblZEIT_TYP.Active := True;
      ShowModal;
    finally
      Release;
    end;
  tblZeitTyp.Requery;
end;

this works for me fine

meikl ;-)
0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
meant if the gridcolumntitle is clicked :-)
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
Hi,
I think the problem is that the current record on FormB.ADOTable remains unchanged after update. So a possible solution could be:
---
...
FormB.ShowModal;
FormB.ADOTable1.Last;
FormB.ADOTable1.First;
FormA.ADOTable1.Refresh;
---

Regards, Geo
0
 

Author Comment

by:cardiod
Comment Utility
Thanks for the quick replys kretzschmar and geobul

I have tried both solutions and they don't work for me. geobul: The data is changing in FormB Ive checked at runtime.

Kretzschmar: I have tried refreshes, requeries, resetting Active, closing the connection and reopening it. They all seem to fail. Are you using the ado components that came with with D5 Enterprise? The only other thing I can check on is subtle differences in set up between your working copy and mine. I have tried your code, it is not too much different in how I do it, I have the connection active set at design time, and this doesn't work either.

Thanks

Cardiod
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Author Comment

by:cardiod
Comment Utility
Hi Kretzschmar, geobul

Seemed to have solved it myself. The property Tansliterate was set to true for the calculated lookup field. setting to false works. Apparently its a translator switch between ANSI characters set and the character set used by the database. The only other thing I have to do is force a refresh of the lookup data on FormB.

This setting is not obvious on connection help files. No wonder people (non experts) like me get confused so easily!

I would like to thank you both for your quick replys.

Regards

Cardiod


0
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
never guessed that,
glad you got it work

ask at community support for keep this q into paq
and refunding your points

meikl ;-)
0
 

Expert Comment

by:ComTech
Comment Utility
Hello all, cardiod has asked in Community Support that this question be placed in PAQ.  He would also like to
award each of you 50 points.

50=kretzschmar
50=geobul

I have reduced the amount of points to 50 to award one Expert here, and will create a new quesstion for geobul in this same Topic Area.

This will finalize and PAQ this question.

Thanks and regards,
ComTech
CS Admin @ EE
0
 

Expert Comment

by:ComTech
Comment Utility
geobul your points can be picked up here.

http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=delphi&qid=20284413

ComTech
0
 
LVL 17

Expert Comment

by:geobul
Comment Utility
Thanks, Cardiod.

Regards, Geo
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

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

15 Experts available now in Live!

Get 1:1 Help Now