A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

locking a form once it has been entered



 
 
Thread Tools Display Modes
  #1  
Old February 9th, 2009, 08:30 PM posted to microsoft.public.access.gettingstarted
Breezy
external usenet poster
 
Posts: 38
Default locking a form once it has been entered

I apologize in advance for asking a question that I know has been asnwered
but I so very new to Access that I dont fully understand some of the answers.
This is what I have:

A form set up to be our Purchase Order forms. I have type of startup menu
that the users can choose to open an existing PO or create a new PO. When
they choose a new PO, the form opens to a blank record. I would like to lock
the exsisting records from being edited by the general user in the instance
where they open an existing PO. I would need to be able to edit the closed
date on the PO though so it does not show on an open PO report I have
generated. I have seen several posts to making changes in the current event
property of the field or locking the field. When I select lock, it locks the
field even on the new or blank form.

I need an Access for dummies / simple terminoligy answer so I can understand
and implement correctly.
Thanks!
  #2  
Old February 9th, 2009, 10:28 PM posted to microsoft.public.access.gettingstarted
Ken Sheridan
external usenet poster
 
Posts: 3,433
Default locking a form once it has been entered

First set the Tag property of all the controls you want locked to:

LockMe

i.e. all the bound controls apart from the Closed Date control and any
buttons, unbound navigational controls etc which you want to be enabled for
existing orders as well as new ones. Then in the form's Current event
procedure put the following code:

Dim ctrl as Control
Dim blnLock as Boolean

blnLock = Not Me.NewRecord

For Each ctrl in Me.Controls
If ctrl.Tag = "LockMe" Then
ctrl.Locked = blnLock
ctrl.Enabled = Not blnLock
End If
Next ctrl

If you are unfamiliar with entering code in event procedures this is how its
done:

Select the form object in form design view by clicking on the small grey
square in its top left corner, and open its properties sheet if its not
already open. Then select the On Current event property in the properties
sheet. Click on the 'build' button; that's the one on the right with 3 dots.
Select 'Code Builder' in the dialogue, and click OK. The VBA window will
open at the event procedure with the first and last lines already in place.
Enter the lines of code between these two existing lines.

Ken Sheridan
Stafford, England

"Breezy" wrote:

I apologize in advance for asking a question that I know has been asnwered
but I so very new to Access that I dont fully understand some of the answers.
This is what I have:

A form set up to be our Purchase Order forms. I have type of startup menu
that the users can choose to open an existing PO or create a new PO. When
they choose a new PO, the form opens to a blank record. I would like to lock
the exsisting records from being edited by the general user in the instance
where they open an existing PO. I would need to be able to edit the closed
date on the PO though so it does not show on an open PO report I have
generated. I have seen several posts to making changes in the current event
property of the field or locking the field. When I select lock, it locks the
field even on the new or blank form.

I need an Access for dummies / simple terminoligy answer so I can understand
and implement correctly.
Thanks!


  #3  
Old February 10th, 2009, 02:56 PM posted to microsoft.public.access.gettingstarted
Breezy
external usenet poster
 
Posts: 38
Default locking a form once it has been entered

That helped!! Thanks!!

"Ken Sheridan" wrote:

First set the Tag property of all the controls you want locked to:

LockMe

i.e. all the bound controls apart from the Closed Date control and any
buttons, unbound navigational controls etc which you want to be enabled for
existing orders as well as new ones. Then in the form's Current event
procedure put the following code:

Dim ctrl as Control
Dim blnLock as Boolean

blnLock = Not Me.NewRecord

For Each ctrl in Me.Controls
If ctrl.Tag = "LockMe" Then
ctrl.Locked = blnLock
ctrl.Enabled = Not blnLock
End If
Next ctrl

If you are unfamiliar with entering code in event procedures this is how its
done:

Select the form object in form design view by clicking on the small grey
square in its top left corner, and open its properties sheet if its not
already open. Then select the On Current event property in the properties
sheet. Click on the 'build' button; that's the one on the right with 3 dots.
Select 'Code Builder' in the dialogue, and click OK. The VBA window will
open at the event procedure with the first and last lines already in place.
Enter the lines of code between these two existing lines.

Ken Sheridan
Stafford, England

"Breezy" wrote:

I apologize in advance for asking a question that I know has been asnwered
but I so very new to Access that I dont fully understand some of the answers.
This is what I have:

A form set up to be our Purchase Order forms. I have type of startup menu
that the users can choose to open an existing PO or create a new PO. When
they choose a new PO, the form opens to a blank record. I would like to lock
the exsisting records from being edited by the general user in the instance
where they open an existing PO. I would need to be able to edit the closed
date on the PO though so it does not show on an open PO report I have
generated. I have seen several posts to making changes in the current event
property of the field or locking the field. When I select lock, it locks the
field even on the new or blank form.

I need an Access for dummies / simple terminoligy answer so I can understand
and implement correctly.
Thanks!


 




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 Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:03 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.