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
|
|||
|
|||
disabling record change
I have a combobox om my form tha contains the values Open, closed. What I
want is when the user selects closed, you cannot change anything in the form for that record |
#2
|
|||
|
|||
disabling record change
Hi,
You could add an After Update event on the combo box. In it check the value and when closed set the form's AllowEdits property to False: Private Sub cbStatus_AfterUpdate() If cbStatus = "Closed" Then Me.AllowEdits = False End If End Sub You will also want to do an On Current event for the form that checks the value and sets the property appropriately so that when the user goes to an open record he can still modify it. Private Sub Form_Current() Me.AllowEdits = (Nz(cbStatus, "Open") = "Open") End Sub Clifford Bass "JOM" wrote: I have a combobox om my form tha contains the values Open, closed. What I want is when the user selects closed, you cannot change anything in the form for that record |
#3
|
|||
|
|||
disabling record change
Remember to add somewhere in your system on some form (perhaps with
some security) a way for some person to be able to change the status back to "Open". This is because I can guarentee you that someone sometime is going to accidentily change the status to closed on some record and request that it be changed back to open because it was by accident or the wrong record or at least 10 other valid reasons. Ron |
#4
|
|||
|
|||
disabling record change
I did what you said, I am having issues. I am unable to modify the records
in my subform. My subform has continous froms. So when one record has "Closed" I am unable to modify the other records i.e., records in the contious forms that have "Open" Private Sub Form_Current() Me.AllowEdits = (Nz(Combo72, "Closed") = "Closed") End Sub Private Sub Combo72_AfterUpdate() If Me.Combo72 = "Closed" Then Me.frmInvTrackingSubform.Form.AllowEdits = False Else Me.frmInvTrackingSubform.Form.AllowEdits = True End If End Sub "Clifford Bass" wrote: Hi, You could add an After Update event on the combo box. In it check the value and when closed set the form's AllowEdits property to False: Private Sub cbStatus_AfterUpdate() If cbStatus = "Closed" Then Me.AllowEdits = False End If End Sub You will also want to do an On Current event for the form that checks the value and sets the property appropriately so that when the user goes to an open record he can still modify it. Private Sub Form_Current() Me.AllowEdits = (Nz(cbStatus, "Open") = "Open") End Sub Clifford Bass "JOM" wrote: I have a combobox om my form tha contains the values Open, closed. What I want is when the user selects closed, you cannot change anything in the form for that record |
#5
|
|||
|
|||
disabling record change
Hi,
Hmmm... I think it is your Form_Current. It will only allow edits when the status is null or "Closed". Try: Me.AllowEdits = (Nz(Combo72, "") "Closed") If that does not work, please be more specific about your situation. I am not quite certain where your Combo72 is located. On the main form or on the subform? Or on both? Clifford Bass "JOM" wrote: I did what you said, I am having issues. I am unable to modify the records in my subform. My subform has continous froms. So when one record has "Closed" I am unable to modify the other records i.e., records in the contious forms that have "Open" Private Sub Form_Current() Me.AllowEdits = (Nz(Combo72, "Closed") = "Closed") End Sub Private Sub Combo72_AfterUpdate() If Me.Combo72 = "Closed" Then Me.frmInvTrackingSubform.Form.AllowEdits = False Else Me.frmInvTrackingSubform.Form.AllowEdits = True End If End Sub |
Thread Tools | |
Display Modes | |
|
|