Re: Lookupfields in grid.. Disappear and reappear :S

From: Vitali Kalinin (vitkalinin_at_yahoo.com)
Date: 04/20/04


Date: Tue, 20 Apr 2004 15:31:13 +0300

Borland ADO wrapper have known problem with lookup fields. As far as I see
from your code you don't want lookup values to be editable, thus I suggest
you to modify underlying SQL of mySP in order to perform lookuping on server
side.

Regards,
Vitali
"Arnoud van Bers xlned.com>" <avbers@<REMOVE4SPAM> сообщил/сообщила в
новостях следующее: news:4084f113$1@newsgroups.borland.com...
> Hi There,
>
> I suffer from a vague problem:
> For lookupfields in a dbgrid I use a (parameterised) query, which executes
> fine but doesn't always show up in a grid...
>
> When opening the grid, I see the following (NOT CORRECT)
> Watch the first column:
>
> http://web10.ontwikkeling.ica.han.nl/1.gif
>
> After scrolling to the end and to the beginning again, I get the following
> result (CORRECT)
>
> http://web10.ontwikkeling.ica.han.nl/2.gif
>
> Suddenly all records are visible..
> At first I thought it would be a repaint or doublebuffering problem.. this
> is not the case!
>
> Code:
>
>
> myFKQuery := TADOQuery.Create(myGrid);
> with myFKQuery do
> begin
> Connection := DataMod.DBConn;
> DataSource := myGrid.Datasource;
> (Can this be a problem? It is absolutely necessary)
> CacheSize := 30;
> SQL.Text := DataMod.cdsColumns.Fields[24].AsString;
> end;
>
> with TStringField.Create(mySP) do
> begin
> ReadOnly := TRUE;
> mySP.Fields[k].Visible := FALSE;
> FieldName := myGrid.DataSource.DataSet.Fields[k].FieldName+'_';
> FieldKind:= fkLookup;
> DataSet := mySP;
> if DataMod.cdsColumns.Fields[2].AsString <> '' then DisplayLabel :=
> DataMod.cdsColumns.Fields[2].AsString;
> Name := FieldName;
> KeyFields:= mySP.Fields[k].FieldName;
> ReadOnly := TRUE;
> Size := 300;
> LookUpDataset:= myFKQuery
> LookUpKeyFields:= DataMod.cdsColumns.Fields[22].AsString;
> LookUpResultField:= mySL.Strings[0];
> mySP.FieldDefs.Add(Name, ftString, 300, false);
>
>
>
> The query is a parameterised query:
>
> SELECT OPLSAMENSTEL.* FROM OPLSAMENSTEL,MODULE B WHERE
> OPLSAMENSTEL.MODULEOPL=B.CODEMODULE and OPLEIDING = :OPLEIDING
>
> Can somebody explain this to me? (and have a solution?? :P)
>
> Greetz,
> Arnoud van Bers
>
> The Netherlands
>
>



Relevant Pages

  • Re: Updateable, Unique List
    ... lookup table: take your unique query and turn it into a MakeTable ... The first column lists the unique values from the original data ...
    (microsoft.public.access.gettingstarted)
  • Re: Basic Question for Lookups.
    ... However, especially in the early phases of setting up your Tables, you will probably need at times to look at their contents, and if so, you probably will want to define lookup properties on the foreign keys. ... The Query that I would suggest is similar to what the Lookup Wizard defines, except that I give mine a name, and I limit it to 2 fields instead of several. ... 1801550689 Michael Zachary Jackson ... I'm properly storing Prospect ID pk then FirstName then Middle then Lastname fields.etc. ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Tip: Table design and query for bracketed lookup
    ... WHERE [Enter Bracket:] ... No rows would be returned by the query! ... If the "lookup" value is in a column of your query called Lookup, ... FROM RateTable RT1 ...
    (microsoft.public.access.queries)
  • Re: WHERE statement
    ... with basically all the info going to one table, except now the suppliers, ... "Jeff Boyce" wrote: ... and you can still use a combobox to list the lookup values. ... I know I get the ID field if I query against a 'lookup' ...
    (microsoft.public.access.gettingstarted)
  • Re: Understanding what makes Access tick
    ... > Query, but which is the subject of a table's lookup relationship. ... allow any "main" record..and "maybe" a child record. ... want here is a simply list of tasknumbers. ...
    (microsoft.public.access.gettingstarted)