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 » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

disabling record change



 
 
Thread Tools Display Modes
  #1  
Old July 29th, 2009, 10:32 PM posted to microsoft.public.access.forms
JOM
external usenet poster
 
Posts: 40
Default 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  
Old July 29th, 2009, 10:58 PM posted to microsoft.public.access.forms
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default 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  
Old July 30th, 2009, 05:35 PM posted to microsoft.public.access.forms
Ron2006
external usenet poster
 
Posts: 936
Default 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  
Old August 6th, 2009, 08:16 PM posted to microsoft.public.access.forms
JOM
external usenet poster
 
Posts: 40
Default 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  
Old August 6th, 2009, 11:12 PM posted to microsoft.public.access.forms
Clifford Bass[_2_]
external usenet poster
 
Posts: 1,295
Default 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

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 07:33 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.