dbTalk Databases Forums  

Record Locking based on the entry in a field

comp.databases.ms-access comp.databases.ms-access


Discuss Record Locking based on the entry in a field in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Nance
 
Posts: n/a

Default Record Locking based on the entry in a field - 11-24-2010 , 04:57 AM






In a medical application, the client needs to lock the patient's daily
record after a supervisor has reviewed and "signed" that day's input.
Can I do that in Access? Can I do it without writing VBA? Nance

Reply With Quote
  #2  
Old   
Salad
 
Posts: n/a

Default Re: Record Locking based on the entry in a field - 11-24-2010 , 06:11 AM






Nance wrote:

Quote:
In a medical application, the client needs to lock the patient's daily
record after a supervisor has reviewed and "signed" that day's input.
Can I do that in Access? Can I do it without writing VBA? Nance
I don't know what you mean by locked. You could try something like
this in your OnCurrent event.
Me.AllowEdits = (Me.SignedOff)
where Me.SignedOff is a boolean field as I don't know your field names.

Reply With Quote
  #3  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Record Locking based on the entry in a field - 11-24-2010 , 10:44 AM



Nance wrote:
Quote:
In a medical application, the client needs to lock the patient's daily
record after a supervisor has reviewed and "signed" that day's input.
Can I do that in Access? Can I do it without writing VBA? Nance
What version of Access are you using? In A2010, there is a new "data macro"
feature that resembles triggers in other rdbms. That would allow you to
write a "before" trigger that would check the field's value and either allow
or rollback the transaction based on that value. This would prevent anyone
from updating the record without first disabling the trigger, much more
foolproof than the techniques you will be forced to use in pre-2010
versions.

Reply With Quote
  #4  
Old   
Nance
 
Posts: n/a

Default Re: Record Locking based on the entry in a field - 11-30-2010 , 04:02 PM



On Nov 24, 11:44*am, "Bob Barrows" <reb01... (AT) NOSPAMyahoo (DOT) com> wrote:
Quote:
Nance wrote:
In a medical application, the client needs to lock the patient's daily
record after a supervisor has reviewed and "signed" that day's input.
Can I do that in Access? *Can I do it without writing VBA? *Nance

What version of Access are you using? In A2010, there is a new "data macro"
feature that resembles triggers in other rdbms. That would allow you to
write a "before" trigger that would check the field's value and either allow
or rollback the transaction based on that value. This would prevent anyone
from updating the record without first disabling the trigger, much more
foolproof than the techniques you will be forced to use in pre-2010
versions.
The client who made the request uses Access 2003.

I've tried the Me.allowedits = (me.Signedoff) but I don't understand
the me.signedoff expression. I presumed that the boolean expression
meant that I needed a yes/no field so I wrote a query, then a macro
that updated a Yes/No field called "Approved" to Yes when the
supervisor's name field was updated. Unfortunately, I don't know how
to use that Approved field in the me.signedoff statement. More help,
please! Nance

Reply With Quote
  #5  
Old   
John Spencer
 
Posts: n/a

Default Re: Record Locking based on the entry in a field - 12-01-2010 , 06:49 AM



I'm not aware of any way to accomplish this without using VBA in Access 2003
and earlier.

Assumptions:
-- Control or field named SupervisorName
-- SupervisorName is Text
-- If SupervisorName is NOT blank then lock the record for editing

Private Sub Form_Current()
Me.AllowEdits = (Len(Me.SupervisorName & vbNullString)=0)
End Sub

(Len(Me.SupervisorName & vbNullString)=0) will return TRUE when SupervisorName
is null or a zero-length string and FALSE in cases where there is at least one
character in the field. Replace supervisorName with the correct field/control
name.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 11/30/2010 5:02 PM, Nance wrote:

Quote:
The client who made the request uses Access 2003.

I've tried the Me.allowedits = (me.Signedoff) but I don't understand
the me.signedoff expression. I presumed that the boolean expression
meant that I needed a yes/no field so I wrote a query, then a macro
that updated a Yes/No field called "Approved" to Yes when the
supervisor's name field was updated. Unfortunately, I don't know how
to use that Approved field in the me.signedoff statement. More help,
please! Nance

Reply With Quote
  #6  
Old   
Nance
 
Posts: n/a

Default Re: Record Locking based on the entry in a field - 12-01-2010 , 08:53 AM



On Dec 1, 7:49*am, John Spencer <JSPEN... (AT) Hilltop (DOT) umbc> wrote:
Quote:
I'm not aware of any way to accomplish this without using VBA in Access 2003
and earlier.

Assumptions:
-- Control or field named SupervisorName
-- SupervisorName is Text
-- If SupervisorName is NOT blank then lock the record for editing

Private Sub Form_Current()
* *Me.AllowEdits = (Len(Me.SupervisorName & vbNullString)=0)
End Sub

(Len(Me.SupervisorName & vbNullString)=0) will return TRUE when SupervisorName
is null or a zero-length string and FALSE in cases where there is at least one
character in the field. *Replace supervisorName with the correct field/control
name.

John Spencer
Access MVP 2002-2005, 2007-2010
The Hilltop Institute
University of Maryland Baltimore County

On 11/30/2010 5:02 PM, Nance wrote:



The client who made the request uses Access 2003.

I've tried the Me.allowedits = (me.Signedoff) but I don't understand
the me.signedoff expression. *I presumed that the boolean expression
meant that I needed a yes/no field so I wrote a query, then a macro
that updated a Yes/No field called "Approved" to Yes when the
supervisor's name field was updated. *Unfortunately, I don't know how
to use that Approved field in the me.signedoff statement. *More help,
please! *Nance- Hide quoted text -

- Show quoted text -
Thank you, John. It works perfectly!! Nance

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.