Audit Table 
Author Message
 Audit Table

Dear Sir

I have  tblmumachine Table and tblmumachineaudit Audit Table, before I do
any action on the tblmumachine I need to run the following statement , but
it's does not work can any u help me ....

SELECT  "Transfer" As straction, DateTime() As dtmactiondatetime ,
strmachinecode, strassetcode, strmachinename, strdepartmentcode,
dtmacquisitiondate, strfromdepartment, dtmtransferdatetime, strtodepartment,
intmubudgetinhours, flgistransfered ;
FROM  tblmumachine ;
Where strmachinecode = 'E05';
INSERT INTO tblmumachineaudit (straction, dtmactiondatetime ,
strmachinecode, strassetcode, strmachinename, strdepartmentcode,
dtmacquisitiondate, tblmumachine.strfromdepartment, dtmtransferdatetime,
strtodepartment,  intmubudgetinhours, flgistransfered);

Regards



Thu, 01 Sep 2005 19:53:30 GMT  
 Audit Table
Mohammed,

Are you running your code in FoxPro against FoxPro data?

--
Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

http://msdn.microsoft.com/vfoxpro  http://foxcentral.net


Quote:
> I have  tblmumachine Table and tblmumachineaudit Audit Table, before I do
> any action on the tblmumachine I need to run the following statement , but
> it's does not work can any u help me ....

> SELECT  "Transfer" As straction, DateTime() As dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, strfromdepartment, dtmtransferdatetime,
> strtodepartment,
> intmubudgetinhours, flgistransfered ;
> FROM  tblmumachine ;
> Where strmachinecode = 'E05';
> INSERT INTO tblmumachineaudit (straction, dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, tblmumachine.strfromdepartment, dtmtransferdatetime,
> strtodepartment,  intmubudgetinhours, flgistransfered);



Thu, 01 Sep 2005 23:16:36 GMT  
 Audit Table
Mohammed -
i would suggest you break it into two sql statements -
statement #1

SELECT  "Transfer" As straction, DateTime() As dtmactiondatetime , ;
 strmachinecode, strassetcode, strmachinename, strdepartmentcode, ;
 dtmacquisitiondate, strfromdepartment, dtmtransferdatetime,
strtodepartment, ;
 intmubudgetinhours, flgistransfered into cursor curs_test ;
 FROM  tblmumachine ;
 Where strmachinecode = 'E05'
if _tally > 0
    select curs_test
    scan
        scatter memvar
        INSERT INTO tblmumachineaudit (straction, dtmactiondatetime , ;
        strmachinecode, strassetcode, strmachinename, strdepartmentcode, ;
        dtmacquisitiondate, tblmumachine.strfromdepartment,
dtmtransferdatetime, ;
        strtodepartment,  intmubudgetinhours, flgistransfered) from memvar
    endscan
endif
-- end of code block --
lemme know if that works for you...  This should work in vfp 7 - you might
have some issues with the length of the fields....
you could, alternatively, use a view based on your sql select criteria -
strmachinecode = 'E05',
then take that view and perform a scan..endscan on it...
mondo regards [Bill]
mondo regards [Bill]

=============================[remove the dot bob to reply]
William Sanders, Electronic Filing Group. MSDN ISV - VFP/SQL .  mySql/ Sql /
Oracle with VFP - YUP!!
972.394.7261 / GoTo China and teach C/SaPPdEV on occasion.
http://window.to/vfoxpro

Quote:
> Dear Sir

> I have  tblmumachine Table and tblmumachineaudit Audit Table, before I do
> any action on the tblmumachine I need to run the following statement , but
> it's does not work can any u help me ....

> SELECT  "Transfer" As straction, DateTime() As dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, strfromdepartment, dtmtransferdatetime,
strtodepartment,
> intmubudgetinhours, flgistransfered ;
> FROM  tblmumachine ;
> Where strmachinecode = 'E05';
> INSERT INTO tblmumachineaudit (straction, dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, tblmumachine.strfromdepartment, dtmtransferdatetime,
> strtodepartment,  intmubudgetinhours, flgistransfered);

> Regards



Sat, 03 Sep 2005 10:38:14 GMT  
 Audit Table
Mohammed,

There are various ways
IN VFP8
INSERT INTO tblmumachineaudit (<column list>) ;
 SELECT <column-list> FROM tblmumachine ;
Where strmachinecode = 'E05'

In VFP7
SELECT <columnlist> FROM tblmumachine ;
Where strmachinecode = 'E05' INTO ARRAY aTemp
IF _TALLY>0
    INSERT INTO tblmumachineaudit FROM ARRAY aTemp
ELSE
messagebox ('no records to insert ')
ENDIF
There are 12 columns. As an array cannot hold more than 65000 elements this
method wouldn't work if you expect more than 4500 rows in the query.  You
can then use this way
IF NOT USED("tblmumachineaudit")
USE tblmumachineaudit AGAIN IN 0
ENDIF
SELECT <columns> FROM tblmumachine INTO CURSOR Temp
SELECT tblmumachineaudit
APPEND [FIELDS columns] FROM DBF('Temp')
USE IN Temp

In VFP you can also create update, insert and delete triggers in stored
procedures so that an audit trail is maintained
CREATE TRIGGER ON Tablename FOR UPDATE AS Logit()
CREATE TRIGGER ON Tablename FOR INSERT AS Logit()
CREATE TRIGGER ON Tablename FOR DELETE AS Logit()
FUNCTION Logit
INSERT INTO Logtable VALUES (SYS(0), DATETIME(),ALIAS(), GETFLDSTATE(-1))
ENDFUNC
GetFldState will show exactly which fields were changed, if thee was a
delete or a new row.
-Anders


Quote:
> Dear Sir

> I have  tblmumachine Table and tblmumachineaudit Audit Table, before I do
> any action on the tblmumachine I need to run the following statement , but
> it's does not work can any u help me ....

> SELECT  "Transfer" As straction, DateTime() As dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, strfromdepartment, dtmtransferdatetime,
strtodepartment,
> intmubudgetinhours, flgistransfered ;
> FROM  tblmumachine ;
> Where strmachinecode = 'E05';
> INSERT INTO tblmumachineaudit (straction, dtmactiondatetime ,
> strmachinecode, strassetcode, strmachinename, strdepartmentcode,
> dtmacquisitiondate, tblmumachine.strfromdepartment, dtmtransferdatetime,
> strtodepartment,  intmubudgetinhours, flgistransfered);

> Regards



Sat, 03 Sep 2005 18:36:04 GMT  
 Audit Table
Surf on over to www.takenote.com and have a look at the FoxAudit software.
It may be simpler than writing your own routines.

--
Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

http://msdn.microsoft.com/vfoxpro  http://foxcentral.net


Quote:
> I have  tblmumachine Table and tblmumachineaudit Audit Table, before I do
> any action on the tblmumachine I need to run the following statement ...



Mon, 05 Sep 2005 11:32:37 GMT  
 Audit Table
Try using transfer instead of "Transfer"

Quote:
>-----Original Message-----
>Mohammed,

>Are you running your code in FoxPro against FoxPro data?

>--
>Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP


http://cindywinegarden.adsl.duke.edu
Quote:
>http://msdn.microsoft.com/vfoxpro  http://foxcentral.net


message

>> I have  tblmumachine Table and tblmumachineaudit Audit
Table, before I do
>> any action on the tblmumachine I need to run the

following statement , but
Quote:
>> it's does not work can any u help me ....

>> SELECT  "Transfer" As straction, DateTime() As
dtmactiondatetime ,
>> strmachinecode, strassetcode, strmachinename,
strdepartmentcode,
>> dtmacquisitiondate, strfromdepartment,

dtmtransferdatetime,
Quote:
>> strtodepartment,
>> intmubudgetinhours, flgistransfered ;
>> FROM  tblmumachine ;
>> Where strmachinecode = 'E05';
>> INSERT INTO tblmumachineaudit (straction,
dtmactiondatetime ,
>> strmachinecode, strassetcode, strmachinename,
strdepartmentcode,
>> dtmacquisitiondate, tblmumachine.strfromdepartment,

dtmtransferdatetime,
Quote:
>> strtodepartment,  intmubudgetinhours, flgistransfered);

>.



Mon, 05 Sep 2005 22:02:02 GMT  
 Audit Table
SanDeep - that's just nuts, imho - it's a value for a column named
straction - why would it make one WHIT of difference?

please let me know your thoughts..
mondo regards [Bill]

Quote:
> Try using transfer instead of "Transfer"

> >-----Original Message-----
> >Mohammed,

> >Are you running your code in FoxPro against FoxPro data?

> >--
> >Cindy Winegarden  MCSD, Microsoft Visual FoxPro MVP

> http://cindywinegarden.adsl.duke.edu
> >http://msdn.microsoft.com/vfoxpro  http://foxcentral.net


> message

> >> I have  tblmumachine Table and tblmumachineaudit Audit
> Table, before I do
> >> any action on the tblmumachine I need to run the
> following statement , but
> >> it's does not work can any u help me ....

> >> SELECT  "Transfer" As straction, DateTime() As
> dtmactiondatetime ,
> >> strmachinecode, strassetcode, strmachinename,
> strdepartmentcode,
> >> dtmacquisitiondate, strfromdepartment,
> dtmtransferdatetime,
> >> strtodepartment,
> >> intmubudgetinhours, flgistransfered ;
> >> FROM  tblmumachine ;
> >> Where strmachinecode = 'E05';
> >> INSERT INTO tblmumachineaudit (straction,
> dtmactiondatetime ,
> >> strmachinecode, strassetcode, strmachinename,
> strdepartmentcode,
> >> dtmacquisitiondate, tblmumachine.strfromdepartment,
> dtmtransferdatetime,
> >> strtodepartment,  intmubudgetinhours, flgistransfered);

> >.



Wed, 07 Sep 2005 00:20:37 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. Auditing changes to table data

2. Auditing changes to tables

3. Audit trail libs, etc. for FoxPro

4. HELP!Audit Log

5. Audit Trail libraries

6. Network Audit Module

7. HELP!Audit log

8. Audit Trail libraries

9. Audit Trails in FoxPro

10. Auditing--> FoxPro

11. Easy Audit?

12. change value in table depending on values in other table

 

 
Powered by phpBB® Forum Software