Solved

Refresh Of Lookup List on DBGrid

Posted on 2002-04-02
9
1,290 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
ID: 6912614
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
ID: 6912622
meant if the gridcolumntitle is clicked :-)
0
 
LVL 17

Expert Comment

by:geobul
ID: 6912642
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:cardiod
ID: 6912939
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
 

Author Comment

by:cardiod
ID: 6913114
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
ID: 6913128
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
ID: 6915338
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
ID: 6915356
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
ID: 6917564
Thanks, Cardiod.

Regards, Geo
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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