Solved

Refresh Of Lookup List on DBGrid

Posted on 2002-04-02
9
1,315 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
[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
  • 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
Independent Software Vendors: 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

Independent Software Vendors: 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

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…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

707 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