Event-driven record locking... help please

M0E-lnx

Registered User.
Local time
Today, 13:47
Joined
Sep 3, 2008
Messages
62
I need a way to do some conditional record locking. I'll try to explain.

I'll be using this database that I'm building to order stuff from different vendors.
The vendor will then issue an invoice to me. When this invoice arrives, I'll be checking for price discrepancies and that sort of things and solve them before actually paying the invoice.
Once this invoice has been paid, I need the record that contains this order locked (set to read-only) but I need to be able to add / edit other records

Can anyone suggest a way to do this?
 
Presuming there's some field in the data that signifies that it's been paid, you can test that field in the current event and set the Allow Edits property accordingly.
 
Presuming there's some field in the data that signifies that it's been paid, you can test that field in the current event and set the Allow Edits property accordingly.

Well, there will be a button to click when the invoice is paid.

Could you elaborate on how to set the allow / edits property for a certain record?
 
I think what Paul means is that you might have a boolean field that you "flip the flag" on when it is paid and then you can test to see if it is true and if so you can set the form's AllowEdits and AllowDeletions to False.
 
But only need that one record locked... there will me many other records to be added and edited
 
Looks like Bob's here to save me again!
 
But only need that one record locked... there will me many other records to be added and edited

And that is why you would have a field in your table which would have a boolean datatype so that you can check that record as complete. The form's On Current event runs on the change of a record so you would be testing each record to see if it was closed or not and acting appropriately.
 
So... just to make sure I get this right... You lock the form while that one record is being displayed... then when you move on to another record, you run the same check again at lock / unlock the form again.
 
I just tried this and it works... but I guess i need to extend it's functionality a bit

This locks the top (header) of my form
but I also have a subform embedded into it (called "PoItems Subform")
I also need it to lock that form to prevent any edition/deletion there too

How do I accomplish that?
 
The simplest way to do this is to add the line in the code where you do the lock/unlock to lock/unlock the subform.

Code:
Me.SubformName.Form.AllowEdits=False
 
Re: Event-driven record locking... help please SOLVED

That worked... Thank you
 
Last edited:

Users who are viewing this thread

Back
Top Bottom