Turning off all fields.

  • Thread starter Thread starter Ted Clore
  • Start date Start date
T

Ted Clore

I would like to turn off all fields when a check box is checked so no more
data can be entered into a record.

Suggestions?

Thank you.
Ted Clore
 
Use the AfterUpdate event of your checkbox to turn the form's AllowEdits
= False.
Also, you'll need to use the OnCurrent event to check the value of the
checkbox, and turn AllowEdits to True or False accordingly.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
I am a Access dummy, could you be a little more specific please. I am not
sure what you mean below.

Thank you Al.

Ted
 
Let's say your checkbox is named Locked, bound to field Locked in your
table.

Use this code in the AfterUpdate event of [Locked]...

Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

Use this code in the OnCurrent event of the form itself...

Private Sub Form_Current()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions
 
I give up. I have tried this any which way, and I am still not able to do
anything. Usually get an error message that says event can not contain
comments.

Thanks for your help Al, I just am not savvy enough with Access to do this.

Thanks again,
Ted


Al Camp said:
Let's say your checkbox is named Locked, bound to field Locked in your
table.

Use this code in the AfterUpdate event of [Locked]...

Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

Use this code in the OnCurrent event of the form itself...

Private Sub Form_Current()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Ted Clore said:
I am a Access dummy, could you be a little more specific please. I am not
sure what you mean below.

Thank you Al.

Ted
 
Ted,
I'll try to help, but I need to see your code... along with a deatiled
description of WHERE and HOW you entered that code.

Do you have any experience with writing event code in the form module?

Let me review the procedure just in case... I'm using the name Locked...
you use your own field name.

In design view, select the Locked field.
In the Properties box for Locked, find the AfterUpdate event, and place
your cursor in it.
Use the little arrow on the right to select Event Procedure from the
list.
Now click the little button on the right with 3 dots ...
You are now in the form module, and should see...
-------------------------------------
Private Sub Locked_AfterUpdate()

End Sub
-------------------------------------

Place the code I gave you between those 2 lines...

--------------------------------------
Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub
-------------------------------

Just try that... in Form view set Locked to True, and see if you can
edit the record afterwards.

Do the same procedure for the OnCurrent event of the Form.

Hang in there...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



Ted Clore said:
I give up. I have tried this any which way, and I am still not able to do
anything. Usually get an error message that says event can not contain
comments.

Thanks for your help Al, I just am not savvy enough with Access to do
this.

Thanks again,
Ted


Al Camp said:
Let's say your checkbox is named Locked, bound to field Locked in your
table.

Use this code in the AfterUpdate event of [Locked]...

Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

Use this code in the OnCurrent event of the form itself...

Private Sub Form_Current()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Ted Clore said:
I am a Access dummy, could you be a little more specific please. I am
not sure what you mean below.

Thank you Al.

Ted




Use the AfterUpdate event of your checkbox to turn the form's
AllowEdits = False.
Also, you'll need to use the OnCurrent event to check the value of
the checkbox, and turn AllowEdits to True or False accordingly.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I would like to turn off all fields when a check box is checked so no
more data can be entered into a record.

Suggestions?

Thank you.
Ted Clore
 
hi Al. i saw Ted's last post, more or less throwing in the towel, so i did
some screen prints illustrating how to implement your solution (a picture's
worth...) and emailed it to him in a .pdf file. (i'm doing some "how to" pdf
files for a project, so it was an opportunity for me to test my premise.) he
emailed back and said your solution worked fine, once he saw how to set up a
VBA procedure.

tina :)


Al Camp said:
Ted,
I'll try to help, but I need to see your code... along with a deatiled
description of WHERE and HOW you entered that code.

Do you have any experience with writing event code in the form module?

Let me review the procedure just in case... I'm using the name Locked...
you use your own field name.

In design view, select the Locked field.
In the Properties box for Locked, find the AfterUpdate event, and place
your cursor in it.
Use the little arrow on the right to select Event Procedure from the
list.
Now click the little button on the right with 3 dots ...
You are now in the form module, and should see...
-------------------------------------
Private Sub Locked_AfterUpdate()

End Sub
-------------------------------------

Place the code I gave you between those 2 lines...

--------------------------------------
Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub
-------------------------------

Just try that... in Form view set Locked to True, and see if you can
edit the record afterwards.

Do the same procedure for the OnCurrent event of the Form.

Hang in there...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



Ted Clore said:
I give up. I have tried this any which way, and I am still not able to do
anything. Usually get an error message that says event can not contain
comments.

Thanks for your help Al, I just am not savvy enough with Access to do
this.

Thanks again,
Ted


Al Camp said:
Let's say your checkbox is named Locked, bound to field Locked in your
table.

Use this code in the AfterUpdate event of [Locked]...

Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

Use this code in the OnCurrent event of the form itself...

Private Sub Form_Current()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I am a Access dummy, could you be a little more specific please. I am
not sure what you mean below.

Thank you Al.

Ted




Use the AfterUpdate event of your checkbox to turn the form's
AllowEdits = False.
Also, you'll need to use the OnCurrent event to check the value of
the checkbox, and turn AllowEdits to True or False accordingly.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I would like to turn off all fields when a check box is checked so no
more data can be entered into a record.

Suggestions?

Thank you.
Ted Clore
 
Tina,
Yes... that's why I asked about his experience, and then laid it out as
clearly as I could.
I think he was trying to enter the code in the property box AfterUpdate
"field" instead of the module.

Thanks for the feedback Tina... glad it all worked it out...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


Thanks for getting back to me
tina said:
hi Al. i saw Ted's last post, more or less throwing in the towel, so i did
some screen prints illustrating how to implement your solution (a
picture's
worth...) and emailed it to him in a .pdf file. (i'm doing some "how to"
pdf
files for a project, so it was an opportunity for me to test my premise.)
he
emailed back and said your solution worked fine, once he saw how to set up
a
VBA procedure.

tina :)


Al Camp said:
Ted,
I'll try to help, but I need to see your code... along with a deatiled
description of WHERE and HOW you entered that code.

Do you have any experience with writing event code in the form module?

Let me review the procedure just in case... I'm using the name Locked...
you use your own field name.

In design view, select the Locked field.
In the Properties box for Locked, find the AfterUpdate event, and
place
your cursor in it.
Use the little arrow on the right to select Event Procedure from the
list.
Now click the little button on the right with 3 dots ...
You are now in the form module, and should see...
-------------------------------------
Private Sub Locked_AfterUpdate()

End Sub
-------------------------------------

Place the code I gave you between those 2 lines...

--------------------------------------
Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub
-------------------------------

Just try that... in Form view set Locked to True, and see if you can
edit the record afterwards.

Do the same procedure for the OnCurrent event of the Form.

Hang in there...
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions



Ted Clore said:
I give up. I have tried this any which way, and I am still not able to do
anything. Usually get an error message that says event can not contain
comments.

Thanks for your help Al, I just am not savvy enough with Access to do
this.

Thanks again,
Ted


Let's say your checkbox is named Locked, bound to field Locked in your
table.

Use this code in the AfterUpdate event of [Locked]...

Private Sub Locked_AfterUpdate()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

Use this code in the OnCurrent event of the form itself...

Private Sub Form_Current()
If [Locked] = True Then
Me.AllowEdits = False
Else
Me.AllowEdits = True
End If
End Sub

hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions


I am a Access dummy, could you be a little more specific please. I am
not sure what you mean below.

Thank you Al.

Ted




Use the AfterUpdate event of your checkbox to turn the form's
AllowEdits = False.
Also, you'll need to use the OnCurrent event to check the value of
the checkbox, and turn AllowEdits to True or False accordingly.
hth
Al Camp
Candia Computer Consulting - Candia NH
http://home.comcast.net/~cccsolutions

I would like to turn off all fields when a check box is checked so
no
more data can be entered into a record.

Suggestions?

Thank you.
Ted Clore
 
Back
Top