Locking a field once populated

S

storm warden

Hi,

I am putting togater a database to help us manage trouble tickets.

i have used
Private Sub TicketEscalated_AfterUpdate()
Me.TimeEscalated = Now()
End Sub

to populate the [TimeEscalated] fiield however i have no idea has ho how to
prevent changes to the field once it has been populated. Also i am having
diffculties locking the [TicketEscalated] field also once hit has been set to
"Yes"

Any help or advice would be greatly appreciated.
 
T

Tom van Stiphout

On Fri, 7 Aug 2009 06:12:01 -0700, storm warden

Add a line:
Me.TimeEscalated.Locked = True

And add this to the Form_Current event:
Me.TimeEscalated.Locked = Not IsNull(Me.TimeEscalated)
That way as you scroll from record to record the control will be
(un-)locked as needed.

-Tom.
Microsoft Access MVP
 
S

storm warden

Thanks Tom,

This does not seem to be working, i think it may be becuause i am using
office 2000.



Tom van Stiphout said:
On Fri, 7 Aug 2009 06:12:01 -0700, storm warden

Add a line:
Me.TimeEscalated.Locked = True

And add this to the Form_Current event:
Me.TimeEscalated.Locked = Not IsNull(Me.TimeEscalated)
That way as you scroll from record to record the control will be
(un-)locked as needed.

-Tom.
Microsoft Access MVP

Hi,

I am putting togater a database to help us manage trouble tickets.

i have used
Private Sub TicketEscalated_AfterUpdate()
Me.TimeEscalated = Now()
End Sub

to populate the [TimeEscalated] fiield however i have no idea has ho how to
prevent changes to the field once it has been populated. Also i am having
diffculties locking the [TicketEscalated] field also once hit has been set to
"Yes"

Any help or advice would be greatly appreciated.
 
C

Chegu Tom

The Locked=true property prevents anyone from entering data by typing it in
the form.
BUT it will allow data to be changed via VB code, which is what you are
doing with --"Me.TimeEscalated = Now()"

Maybe you need to explore the enabled=false property instead (I am not
positive this will prevent update via VB code but it is worth a try)

Tom

storm warden said:
Thanks Tom,

This does not seem to be working, i think it may be becuause i am using
office 2000.



Tom van Stiphout said:
On Fri, 7 Aug 2009 06:12:01 -0700, storm warden

Add a line:
Me.TimeEscalated.Locked = True

And add this to the Form_Current event:
Me.TimeEscalated.Locked = Not IsNull(Me.TimeEscalated)
That way as you scroll from record to record the control will be
(un-)locked as needed.

-Tom.
Microsoft Access MVP

Hi,

I am putting togater a database to help us manage trouble tickets.

i have used
Private Sub TicketEscalated_AfterUpdate()
Me.TimeEscalated = Now()
End Sub

to populate the [TimeEscalated] fiield however i have no idea has ho how
to
prevent changes to the field once it has been populated. Also i am
having
diffculties locking the [TicketEscalated] field also once hit has been
set to
"Yes"

Any help or advice would be greatly appreciated.
 
J

John W. Vinson

The Locked=true property prevents anyone from entering data by typing it in
the form.
BUT it will allow data to be changed via VB code, which is what you are
doing with --"Me.TimeEscalated = Now()"

Maybe you need to explore the enabled=false property instead (I am not
positive this will prevent update via VB code but it is worth a try)

It won't help, actually: LOCKED and ENABLED are both applied only to user
input, and will be ignored by code.

What you'll need to do is check *in the code* before the
Me.TimeEscalated=Now() line to see if the change should be made. If you want
this value to be assigned only in a new record you could use

If Me.NewRecord Then
Me.TimeEscalated = Now
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top