Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Lock file for new record
Message
De
07/01/2007 23:12:02
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01183257
Message ID:
01183351
Vues:
11
>Hi all,
>I am locking for a good way to lock file for new records.Its mean after replacing and saving entries, no allowed to any one to enter or edit records.
>after fix date or after some filter condiations. like ..
>set filer to month january07=lock
>thanks

As an example, I would do the following in Visual Extend - if you use another framework, you must research how it is done in your framework:

Form.OnRecordMove() is invoked automatically by the framework, every time a new record is selected. So, I would use this method to do something like this:
* Method Form.OnRecordMove()
if (Put condition here)
  ThisForm.lCanEdit = .F.
  ThisForm.lCanDelete = .F.
endif
DoDefault()
If I remember correctly, the DoDefault() should go at the end, because this is the place where the Form.Refresh() is done, and controls are enabled and disabled.

The framework takes care of disabling all controls when editing is disabled.

If you use your own framework instead of a third-party framework, you might consider something similar: disabling all form controls when a certain form property (like ThisForm.lCanEdit) is false.

Another option is to only do the check when the record is saved (you DO use buffering, I hope...), but this may be confusing for the user. If the controls are disabled in the first place, then it is quite clear that he can't do any changes.

You might also disable editing with triggers: if you don't want to do changes, the trigger function will simply return the value .F. You will need to check this condition both for the delete and update case.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform