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
|
|||
|
|||
Prevent edits - unexpected effects
I have a form which I have locked for edits (in properties) to avoid
accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#2
|
|||
|
|||
Prevent edits - unexpected effects
Setting AllowEdits to No for a form affects all controls on the form.
Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#3
|
|||
|
|||
Prevent edits - unexpected effects
Hi,
This sounds like the 'magic bullet' I've been seeking. I would like to place a checkbox on my form which is bound to the underlying table and is called 'Complete'. Until deselected/unchecked, the user would be unable to edit any data on the form (and the 'child' subform which has referential integrity established). I thought I'd call the checkbox control 'Complete'. Is this what this is supposed to give? TIA. "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#4
|
|||
|
|||
Prevent edits - unexpected effects
Hi,
I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#5
|
|||
|
|||
Prevent edits - unexpected effects
Call the code in Form_Current, and Form_AfterUpdate, passing:
Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#6
|
|||
|
|||
Prevent edits - unexpected effects
I think this is really going to be helpful....
I hate to bother you, but I think this posting could use a little more detail: How do you mean 'call the code in form_current and form_afterupdate', passing NZ(Me.Complete.value,False)'? I already have some code in the on current event of the form's but not in the after update one. I guess this scenario of mine does not involve creating the button in your download instructions but that a red rectangle is a good idea. Basically, I need to be able to wrap my mind around the mechanics of implementing your workaround/suggestion. TIA "Allen Browne" wrote: Call the code in Form_Current, and Form_AfterUpdate, passing: Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? Chris |
#7
|
|||
|
|||
Prevent edits - unexpected effects
We assume you already have the code from this article in your database:
http://allenbrowne.com/ser-56.html Steps: 1. Open the form in design view. 2. In the Properties box, looking at the properties of the Form, on the Event tab, set the On Current property to: [Event Procedure] 3. Click the Build button (...) beside this property. Acdess opens the code window. 4. Set up the code like this: Private Sub Form_Current() Call LockBoundControls(Nz(Me.Complete.Value, False)) End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I think this is really going to be helpful.... I hate to bother you, but I think this posting could use a little more detail: How do you mean 'call the code in form_current and form_afterupdate', passing NZ(Me.Complete.value,False)'? I already have some code in the on current event of the form's but not in the after update one. I guess this scenario of mine does not involve creating the button in your download instructions but that a red rectangle is a good idea. Basically, I need to be able to wrap my mind around the mechanics of implementing your workaround/suggestion. TIA "Allen Browne" wrote: Call the code in Form_Current, and Form_AfterUpdate, passing: Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? |
#8
|
|||
|
|||
Prevent edits - unexpected effects
Since I already have other code in the on_current event, can I just add this
line at the top Call LockBoundControls([Form], Nz(Me.Complete.Value, False), Me.Complete) since I want to exempt the me.complete checkbox? A few other things on this, can/should I add this to the following event properties, namely after_update and on_load =lockboundcontrols([Form],Nz(Me.Complete.Value,False),Me.Complete) which I got the impression from the code's documentation are required? Thanks, this looks really promising! "Allen Browne" wrote: We assume you already have the code from this article in your database: http://allenbrowne.com/ser-56.html Steps: 1. Open the form in design view. 2. In the Properties box, looking at the properties of the Form, on the Event tab, set the On Current property to: [Event Procedure] 3. Click the Build button (...) beside this property. Acdess opens the code window. 4. Set up the code like this: Private Sub Form_Current() Call LockBoundControls(Nz(Me.Complete.Value, False)) End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I think this is really going to be helpful.... I hate to bother you, but I think this posting could use a little more detail: How do you mean 'call the code in form_current and form_afterupdate', passing NZ(Me.Complete.value,False)'? I already have some code in the on current event of the form's but not in the after update one. I guess this scenario of mine does not involve creating the button in your download instructions but that a red rectangle is a good idea. Basically, I need to be able to wrap my mind around the mechanics of implementing your workaround/suggestion. TIA "Allen Browne" wrote: Call the code in Form_Current, and Form_AfterUpdate, passing: Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? |
#9
|
|||
|
|||
Prevent edits - unexpected effects
Allen,
Perhaps I needed to add mention that the me.complete control has some code on two of the event properties, namely Private Sub Complete_AfterUpdate() If Me.Complete = -1 Then Me![Label59].BackColor = vbGreen Me![Label59].ForeColor = vbBlack Me![Label59].Caption = "Form is Complete" End If If Me.Complete = 0 Then Me![Label59].BackColor = vbRed Me![Label59].ForeColor = vbYellow Me![Label59].Caption = "Form is Incomplete" End If End Sub which also appears in on_current "Allen Browne" wrote: We assume you already have the code from this article in your database: http://allenbrowne.com/ser-56.html Steps: 1. Open the form in design view. 2. In the Properties box, looking at the properties of the Form, on the Event tab, set the On Current property to: [Event Procedure] 3. Click the Build button (...) beside this property. Acdess opens the code window. 4. Set up the code like this: Private Sub Form_Current() Call LockBoundControls(Nz(Me.Complete.Value, False)) End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I think this is really going to be helpful.... I hate to bother you, but I think this posting could use a little more detail: How do you mean 'call the code in form_current and form_afterupdate', passing NZ(Me.Complete.value,False)'? I already have some code in the on current event of the form's but not in the after update one. I guess this scenario of mine does not involve creating the button in your download instructions but that a red rectangle is a good idea. Basically, I need to be able to wrap my mind around the mechanics of implementing your workaround/suggestion. TIA "Allen Browne" wrote: Call the code in Form_Current, and Form_AfterUpdate, passing: Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? |
#10
|
|||
|
|||
Prevent edits - unexpected effects
This has been working quite well until now when I noticed that if the user
were to click the 'Complete' checkbox on a new record w/o first having entered the required ID data (there's also an MRADATE field which is set to 'required') that a error message '3314 - The field 'tbl_MRA_Form.ID' cannot contain a Null value because the Required property for this field is set to True. Enter a value in this field" shows up! Ordinarily the person entering these data oughtn't be attempting to lock an empty record so it's not likely to be ongoing; on the other hand, I noticed that the check in the 'Complete' checkbox is present after the user hits the 'Ok' on error 3314's msg? That means that the form is coded as having been locked and completed even before any valid data is entered. Any thoughts? "Allen Browne" wrote: We assume you already have the code from this article in your database: http://allenbrowne.com/ser-56.html Steps: 1. Open the form in design view. 2. In the Properties box, looking at the properties of the Form, on the Event tab, set the On Current property to: [Event Procedure] 3. Click the Build button (...) beside this property. Acdess opens the code window. 4. Set up the code like this: Private Sub Form_Current() Call LockBoundControls(Nz(Me.Complete.Value, False)) End Sub -- Allen Browne - Microsoft MVP. Perth, Western Australia Tips for Access users - http://allenbrowne.com/tips.html Reply to group, rather than allenbrowne at mvps dot org. "Access User" wrote in message ... I think this is really going to be helpful.... I hate to bother you, but I think this posting could use a little more detail: How do you mean 'call the code in form_current and form_afterupdate', passing NZ(Me.Complete.value,False)'? I already have some code in the on current event of the form's but not in the after update one. I guess this scenario of mine does not involve creating the button in your download instructions but that a red rectangle is a good idea. Basically, I need to be able to wrap my mind around the mechanics of implementing your workaround/suggestion. TIA "Allen Browne" wrote: Call the code in Form_Current, and Form_AfterUpdate, passing: Nz(Me.Completed.Value, False) If the check box is true, this will lock it. If the check box is false, this will unlock the record. If the check box is null (e.g. at a new record), it will unlock it. "Access User" wrote in message ... I've had a chance to implement this code and controls onto my form and I think I understand what it's doing and what it isn't doing. It seems to lock the user out from making any modifications to any records bound to the form/subform. What would like is to allow the user to see which records have been entered completely into the database. I currently have a checkbox control on it which is bound to a field in the underlying table and is called 'Complete'. Its label is red if it's been checked and green if it hasn't been and its status varies from one record to the next as the user scrolls through each record. But it fails to do what your cmdbutton did and that is prevent any edits to a record once the checkbox is selected. Thoughts? "Allen Browne" wrote: Setting AllowEdits to No for a form affects all controls on the form. Therefore the subform control is locked well. Even unbound controls are unusable. Here's an alternative approach: Locking bound controls on a form and subforms at: http://allenbrowne.com/ser-56.html This is a piece of code that leaves the form's AllowEdits property unchanged, but sets the Locked property of the bound controls instead. The unbound controls are therefore still usable. The code does lock the subforms too, but it accepts a list of controls to NOT lock. So, if you tell it not to lock your subform, it leaves it unchanged. "chris" wrote in message ... I have a form which I have locked for edits (in properties) to avoid accidental changes to data, and have place a command button on it to allow edits. There is a subform on this form which previously allowed users to add new associated records through the normal add record row at the bottom. However, when I chose to prevent edits on the main form I found that the add records row in the subform was greyed out. Clicking the command button to allow edits to the main form did not affect the subform. Has anyone got any idea why is might be happening and how I can overcome the problem? |
Thread Tools | |
Display Modes | |
|
|