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
|
|||
|
|||
How to make the form read only when field status is CLOSED
I have a DB of Issues, there is a field Status (Active Closed Resolved).
I need when a person change the STATUS field to CLOSE to automatticaly set the Edit to "NO" so the fields in the form would show in Read Only, BUT leave the field STATUS open for edits to Reopen the Issue. I may have an idea how to do that but don't know how to coded, can these be done with a macro or VB code. Can somebody give me some direction? Tks in advance. Mario |
#2
|
|||
|
|||
How to make the form read only when field status is CLOSED
"Mario" wrote in message
... I have a DB of Issues, there is a field Status (Active Closed Resolved). I need when a person change the STATUS field to CLOSE to automatticaly set the Edit to "NO" so the fields in the form would show in Read Only, BUT leave the field STATUS open for edits to Reopen the Issue. I may have an idea how to do that but don't know how to coded, can these be done with a macro or VB code. Can somebody give me some direction? Tks in advance. Mario Since you want to lock all but a single field you'll need to loop through all controls on the form and set each one's Locked property to True. Create a sub procedure something like this: Sub LockControls(bLock As Boolean) Dim ctl As Control For Each ctl In Me.Controls If ctl.Tag = "Lock" Then ctl.Locked = bLock End If Next ctl End Sub For each control you want locked, enter the text "Lock" (without the quotes) into the Tag property. Then, in the AfterUpdate event of the STATUS field, call LockControls and pass the appropriate Boolean value: If Me.STATUS = "CLOSE" Then LockControls True Else LockControls False End If Carl Rapson |
#3
|
|||
|
|||
How to make the form read only when field status is CLOSED
you'd want to add
on error resume next to that one, as some controls don't have a locked property, but can be ignored for that very same reason Pieter "Carl Rapson" wrote in message ... "Mario" wrote in message ... I have a DB of Issues, there is a field Status (Active Closed Resolved). I need when a person change the STATUS field to CLOSE to automatticaly set the Edit to "NO" so the fields in the form would show in Read Only, BUT leave the field STATUS open for edits to Reopen the Issue. I may have an idea how to do that but don't know how to coded, can these be done with a macro or VB code. Can somebody give me some direction? Tks in advance. Mario Since you want to lock all but a single field you'll need to loop through all controls on the form and set each one's Locked property to True. Create a sub procedure something like this: Sub LockControls(bLock As Boolean) Dim ctl As Control For Each ctl In Me.Controls If ctl.Tag = "Lock" Then ctl.Locked = bLock End If Next ctl End Sub For each control you want locked, enter the text "Lock" (without the quotes) into the Tag property. Then, in the AfterUpdate event of the STATUS field, call LockControls and pass the appropriate Boolean value: If Me.STATUS = "CLOSE" Then LockControls True Else LockControls False End If Carl Rapson |
#4
|
|||
|
|||
How to make the form read only when field status is CLOSED
Carl;
Your suggestion works for me, i also add the Pieter suggestion for error rtn. Tks guys. "Carl Rapson" wrote: "Mario" wrote in message ... I have a DB of Issues, there is a field Status (Active Closed Resolved). I need when a person change the STATUS field to CLOSE to automatticaly set the Edit to "NO" so the fields in the form would show in Read Only, BUT leave the field STATUS open for edits to Reopen the Issue. I may have an idea how to do that but don't know how to coded, can these be done with a macro or VB code. Can somebody give me some direction? Tks in advance. Mario Since you want to lock all but a single field you'll need to loop through all controls on the form and set each one's Locked property to True. Create a sub procedure something like this: Sub LockControls(bLock As Boolean) Dim ctl As Control For Each ctl In Me.Controls If ctl.Tag = "Lock" Then ctl.Locked = bLock End If Next ctl End Sub For each control you want locked, enter the text "Lock" (without the quotes) into the Tag property. Then, in the AfterUpdate event of the STATUS field, call LockControls and pass the appropriate Boolean value: If Me.STATUS = "CLOSE" Then LockControls True Else LockControls False End If Carl Rapson |
#5
|
|||
|
|||
How to make the form read only when field status is CLOSED
Pieter;
Tks for the that detail, i need it! "Pieter Wijnen" wrote: you'd want to add on error resume next to that one, as some controls don't have a locked property, but can be ignored for that very same reason Pieter "Carl Rapson" wrote in message ... "Mario" wrote in message ... I have a DB of Issues, there is a field Status (Active Closed Resolved). I need when a person change the STATUS field to CLOSE to automatticaly set the Edit to "NO" so the fields in the form would show in Read Only, BUT leave the field STATUS open for edits to Reopen the Issue. I may have an idea how to do that but don't know how to coded, can these be done with a macro or VB code. Can somebody give me some direction? Tks in advance. Mario Since you want to lock all but a single field you'll need to loop through all controls on the form and set each one's Locked property to True. Create a sub procedure something like this: Sub LockControls(bLock As Boolean) Dim ctl As Control For Each ctl In Me.Controls If ctl.Tag = "Lock" Then ctl.Locked = bLock End If Next ctl End Sub For each control you want locked, enter the text "Lock" (without the quotes) into the Tag property. Then, in the AfterUpdate event of the STATUS field, call LockControls and pass the appropriate Boolean value: If Me.STATUS = "CLOSE" Then LockControls True Else LockControls False End If Carl Rapson |
Thread Tools | |
Display Modes | |
|
|