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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|