Solved

Refresh Of Lookup List on DBGrid

Posted on 2002-04-02
9
1,239 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
 

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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Edureka is one of the fastest growing and most effective online learning sites.  We are here to help you succeed.

911 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

18 Experts available now in Live!

Get 1:1 Help Now