Subject Re: [IBO] Re:Record was not located to update / Helen - Answer to Q
Author Johannes Pretorius
Good day all
=-0==-0-0=-0=

In answer to the questions so far.

1)My keylinks are

MEDICAL_AID.CODE
MEDICAL_AID.RATE_CODE
This is the Medical aid Code from the Medical aid table and the Rate code for that
Medical aid. Basically a Medical aid can have more than one rate code , thus you can have multiples of
a medical aid code and have differant rates (The Medical aid Plans)

2) The user must be able to change the Medical aid code and the rate as needed. This is to
make it customizable for there practice.

3) It is how the Primary Key is setup. It is a combined field of CODE and RATE_CODE

4) The procedure is as follows. The User can change as many medical aid information as they want
via the Query being in Cached updates and scrolling up and down the grid or Finding (Via Locate) the medical aids.
After EVERY medical aid is changed the user is trained to press a Update Record button that Will POST the information to the Query Component

When all is done the user can press the SAVE button that will execute the following line of Code

//============= CODE START ==============
procedure TfrmInformasieBeheer.btnStoorDAtaClick(Sender: TObject);
begin
inherited;
try
if dsInformasieData.DataSet is TIBOQuery then begin
if TIBOQuery(dsInformasieData.DataSet).state in [dsEdit,dsInsert] then begin
TIBOQuery(dsInformasieData.DataSet).post;
end;
dm.dbMainPromed.ApplyUpdates([TIBOQuery(dsInformasieData.DataSet)]);
end else begin
dm.Database1.ApplyUpdates([TQuery(dsInformasieData.DataSet)]);
end;

close;
Except
on e:Exception do begin
raise Exception.Create('[IB-SDC01] : '+e.Message);
end;
end;
end;
//============= CODE END ==========================

I hope this answers the questions.

(Please excuse my English as I am very bad in it)

Yours SIncerely

Johannes Pretorius


At 04:04 24/09/2005, you wrote:

>At 02:12 PM 23/09/2005 +0200, you wrote:
>>Sorry for asking this again, but can somebody please see if than give us
>>any ideas on how to fix this
>
>Not immediately; but could you answer these questions to try to get some
>understanding of what you are trying to do here:
>
>1. What are your KeyLinks?
>
>2. Why are you allowing a user to edit the primary key?
>
>3. (related to 2) Why do you have two search criteria in the update
>statement?
>
>4. (related to all) What mechanism is being used to submit this update
>statement?
>
>Helen
>===============================
>>WE are havbing a problem where we use IBOQuery where Cached Updates are ON.
>>We use a normal TDataSet and a Normal TDBGrid and normal
>>TDBEdit .
>>
>>IBObjects 4.5 Ai
>>
>>Delphi version : 3
>>(We want to convert all db access to IBO before converting over to D5 or
>>D2005)
>>
>>The Interbase version is 5.6
>>
>>Ekstra information regarding this.
>>
>>KeyLinks :
>>
>>MEDICAL_AID.CODE
>>MEDICAL_AID.RATE_CODE
>>
>>Scenario
>>
>>WE Edit a Record. Do a post and then a Database.ApplyUpdates([Query]);
>>
>>The funny part is that when the error pops up (Record was not located to
>>update)
>>the DBGrid that we have in the background has MULTIPLES of only ONE entry
>>over and over again.
>>When we click okay the Grid displays normal again.
>>
>>We have narrowed the problem down to the procedure in IBODataset
>>
>>procedure TIBOUpdateSQL.ExecSQL
>>
>>The following information is for the Query Component that we use to update
>>and display on grid.
>>
>>//============ QUERY ==================
>>SELECT
>> CODE
>> , NAME
>> , RATE_CODE
>> , ADMINISTRATOR_NAME
>> , CPT4
>> , PERCENTAGE
>> , PATIENT_PERCENTAGE
>> , REFERENCE_VALIDATION
>> , REFERENCE
>> , EMPLOYER
>> , MESSAGE_NUMBER
>> , DATE_ENTERED
>> , MASK
>> , OLD_CODE
>> , ELIG_ENABLED
>> , CLAIMS_ENABLED
>> , EDI_TEMPLATE
>> , CLAIMBEFOREEXPORT
>> , CLAIMS_ADDR
>> , ELIG_ADDR
>> , CLAIM_PART_ADDR
>> , NOTE
>> , ENABLED
>> , VERSTEK
>> , BTW_NOMMER
>>FROM MEDICAL_AID
>>
>>//================ END QUERY ==================\
>>//================= UPDATE ==================
>>UPDATE MEDICAL_AID SET
>> CODE = :CODE, /*PK*/
>> RATE_CODE = :RATE_CODE, /*PK*/
>> NAME = :NAME,
>> ADMINISTRATOR_NAME = :ADMINISTRATOR_NAME,
>> CPT4 = :CPT4,
>> PERCENTAGE = :PERCENTAGE,
>> PATIENT_PERCENTAGE = :PATIENT_PERCENTAGE,
>> REFERENCE_VALIDATION = :REFERENCE_VALIDATION,
>> REFERENCE = :REFERENCE,
>> EMPLOYER = :EMPLOYER,
>> MESSAGE_NUMBER = :MESSAGE_NUMBER,
>> DATE_ENTERED = :DATE_ENTERED,
>> MASK = :MASK,
>> OLD_CODE = :OLD_CODE,
>> ELIG_ENABLED = :ELIG_ENABLED,
>> CLAIMS_ENABLED = :CLAIMS_ENABLED,
>> EDI_TEMPLATE = :EDI_TEMPLATE,
>> CLAIMBEFOREEXPORT = :CLAIMBEFOREEXPORT,
>> CLAIMS_ADDR = :CLAIMS_ADDR,
>> ELIG_ADDR = :ELIG_ADDR,
>> CLAIM_PART_ADDR = :CLAIM_PART_ADDR,
>> NOTE = :NOTE,
>> ENABLED = :ENABLED,
>> VERSTEK = :VERSTEK,
>> BTW_NOMMER = :BTW_NOMMER
>>WHERE
>> CODE = :OLD_CODE AND
>> RATE_CODE = :OLD_RATE_CODE
>>
>>//============== END UPDATE==================
>
>
>
>
>
>___________________________________________________________________________
>IB Objects - direct, complete, custom connectivity to Firebird or InterBase
> without the need for BDE, ODBC or any other layer.
>___________________________________________________________________________
>http://www.ibobjects.com - your IBO community resource for Tech Info papers,
>keyword-searchable FAQ, community code contributions and more !
>Yahoo! Groups Links
>
>
>
>
>
>
>
>
>
>--
>No virus found in this incoming message.
>Checked by AVG Anti-Virus.
>Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date: 21/09/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.344 / Virus Database: 267.11.4/109 - Release Date: 21/09/2005