Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Triggers
Message
De
02/03/2001 11:52:31
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, États-Unis
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Titre:
Divers
Thread ID:
00481011
Message ID:
00481428
Vues:
12
Mark,

I tried the assert and it seems to be erroring out on the !USED(...) command in the go_insert procedure.

Any ideas?

Jim

>First I added formatting for clarity.
>>PROCEDURE ChangeMade
>>   do go_insert with 2
>>
>>PROCEDURE RecInsert
>>   do go_insert with 1
>>
>>PROCEDURE RecDelete
>>   do go_insert with 3
>>
>>PROCEDURE getp_key
>>   LOCAL lnp_key
>>   lnp_key = 0
>>   calculate max(mpart.p_key) to lnp_key
>>   return lnp_key+1
>>
>>PROCEDURE go_insert
>>* Values passed: 1-add(insert or recall), 2-update, 3-delete.
>>LPARAMETERS lnchange
>
><b>ASSERT .F.</b>
>
>>LOCAL lnresults, lcfname, lcrplfield
>>&& open the audtrail table if it's not open and append a blank
>>IF !USED("audtrail")
>>   use audtrail in 0
>>ENDIF
>>select audtrail
>>append blank
>>
>>* Set the change type and p_key fields
>>replace changetype with lnchange in audtrail
>>replace p_key with mpart.p_key in audtrail
>>
>>&& Create an array with the field names in the mpart table.
>>select mpart
>>lnFields = AFIELDS(laFields)
>>FOR I = 1 TO lnFields
>>   lnresults = getfldstate(lafields(I,1))
>>   IF lnresults = 2
>>      lcrplfield = "mpart."+alltrim(lafields(I,1))
>>      lcfname = lafields(I,1)
>>      replace &lcfname with &lcrplfield in audtrail
>>   ENDIF
>>ENDFOR
>
>Just looking at this, I have no idea why you get the record in use error. I would put an ASSERT at the beginning of the GO_INSERT proc and SET ASSERTS ON in the command window. Then do your append blank. Use the debugger to step through the code until you hit the error. You might also table buffer the audit table before you append the record.
>
>Take a look at GetFldState in the VFP Help. Specifically, the return value is 3 or 4 in an appended record. Why would you audit a new record? Don't you only want to audit changes to existing records.
>
>Also, since you have every field in the audit table that you do in the original table, why not just make it easy and SCATTER the original record then GATHER the values into the new audit record?
Thanks

Jim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform