Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Ken Murphy
  Where is Ken Murphy?
 Springhill
 Canada
 Ken Murphy
 To: subhankar pandey
  Where is subhankar pandey?
 Kolkata/Delhi
 India
 subhankar pandey
 Tags
Subject: RE: How to prevent to modify record
Thread ID: 155246 Message ID: 155304 # Views: 2 # Ratings: 1
Version: Visual FoxPro 8 Category: Databases, Tables and SQL Server
Date: Saturday, December 29, 2007 1:23:50 PM         
   


> Yes Ken & Mike,
>
> As per yr advise I hv done the following code in my prg i.e.
> 	SELECT partyname.P_name, partyname.address1, partyname.address2, debitnote.*, calculation1.*, ; 
> 	calculation2.*  ;
>     FROM partyname  ;
>     INNER JOIN debitnote ON partyname.record_id = debitnote.record_id ;     
>     LEFT OUTER JOIN Calculation1 ON Calculation1.Record_ID = DebitNote.Record_ID ;
>     LEFT OUTER JOIN Calculation2 ON Calculation2.Record_ID = DebitNote.Record_ID ;
>     Where thisform.txtDebitnote.value = debitnote.Denitnoten ;
>     ORDER BY partyname.p_name ;
>     INTO CURSOR MyReportCursor
>     Report Form lcldebit1 TO PRINTER PROMPT PREVIEW
> 

> Now in report preview screen, there is system generated menu bar where print icon is avl,upon click print icon user can print the report lcldebit1.frx.
> Now how do I control the below code there :-
> select partyname
> IF partyname.lPrinted
> =messagebox("Record has been printed so do not modify")
> RETURN .F. 
> ELSE
> =messagebox("Record has not been printed so go ahead.")
> RETURN .T. 
> ENDIF
> 

>
> FYi, I'm not using FRX2ANY nither any other pack too.
>
> Regards
> subhankar
>
> > Not sure what you are asking here. If you print the record to an Excel file (using FRX2ANY or something like that) the user can then modify the value in the excel file and there isn't really anything that you can do about it.
> >
> > If, after the report has been printed, you wish to make that record "read only," there really isn't a native function to help you out. On the other hand, you can "roll yer own" so to speak. Add a logical field to the table and call it "lPrinted." You can then add a business rule that prevents an update if the record has already been printed. Something like this:
> >
> >
> > IF MyTable.lPrinted
> >    RETURN .f.   && Record has been printed so do not modify
> > ELSE
> >    RETURN .T.   && Record has not been printed so go ahead.
> > ENDIF
> 

> > Ken
> > You shall know the truth - and the truth shall set you free. (John 8:33)


Begin by adding PartyName.RecordID to your query. This will give you the RecordID you need for the update process. After you have printed your report, use a MESSAGEBOX() to determine if the report has printed correctly and then you can set your lPrinted to .t.

IF MESSAGEBOX("Did the report print correctly?", 20, "Please Verify") = 6
   SELECT MyReportCursor
   SCAN
      IF SEEK(MyReportCursor.RecordID,[PartyName],[MyPrimaryKeyTag]) AND llAnyOtherConditionsYouWant
         REPLACE PartyName.lPrinted WITH .t. IN [PartyName]
      ENDIF
   ENDSCAN
ENDIF


Ken
You shall know the truth - and the truth shall set you free. (John 8:33)

ENTIRE THREAD

How to prevent to modify record Posted by subhankar pandey @ 12/28/2007 1:20:53 PM
RE: How to prevent to modify record Posted by Mike Gagnon @ 12/28/2007 1:59:13 PM
RE: How to prevent to modify record Posted by Ken Murphy @ 12/28/2007 2:00:27 PM
RE: How to prevent to modify record Posted by subhankar pandey @ 12/29/2007 8:43:59 AM
RE: How to prevent to modify record Posted by Olaf Doschke @ 12/29/2007 12:45:49 PM
RE: How to prevent to modify record Posted by subhankar pandey @ 12/31/2007 6:22:15 AM
RE: How to prevent to modify record Posted by Ken Murphy @ 12/29/2007 1:23:50 PM
RE: How to prevent to modify record Posted by subhankar pandey @ 12/31/2007 6:20:37 AM
RE: How to prevent to modify record Posted by Olaf Doschke @ 12/28/2007 10:55:48 PM
RE: How to prevent to modify record Posted by subhankar pandey @ 12/29/2007 8:57:01 AM
RE: How to prevent to modify record Posted by Olaf Doschke @ 12/29/2007 1:10:12 PM
RE: How to prevent to modify record Posted by subhankar pandey @ 12/31/2007 6:24:55 AM