Data Change Protection Code

A

Alvin

I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
DoCmd.Requery

End Sub
 
R

Rick B

One note, you need to also include this code in your form's CURRENT event.
Otherwise, it will not check the field and update the status of the controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do this
if they change an existing record? Not really sure how you would control
this. Once they start editing you want to force them to stay on the record?

--
Rick B



Alvin said:
I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
DoCmd.Requery

End Sub
 
A

Alvin

Thank you Rick,
I got it working and I do have code in the current event of the Form. Here
is how I did it. You'll se I added a requery for my option Group
"Protect.Requery".

-------------This code is in the on click event of my options
Group-------------
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
Protect.Requery

End Sub
-----------------End Code-------------------------------


This code is in the oncurrent event of the form
----------------Code Start------------------------------
Private Sub Form_Current()
If Me.Protect = True Then
Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False

Else
If Me.Protect = False Then
Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True

End If
End If
End Sub
-----------------------Code End---------------------------

Rick B said:
One note, you need to also include this code in your form's CURRENT event.
Otherwise, it will not check the field and update the status of the controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do this
if they change an existing record? Not really sure how you would control
this. Once they start editing you want to force them to stay on the record?

--
Rick B



Alvin said:
I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
DoCmd.Requery

End Sub
 
J

John Griffiths

Hi Alvin

You can reduce the amount of coding for
a list of controls to be affected in a systematic way by
writing a sub routine to do the donkey work.

ie Keeping the various lists from [AnimalName] to [Notes] in sequence
across a whole project can be arduous and error prone.
I've put "/" around the value in the Tag property so that other
information can be added such as "/Colorable/" or "/Hideable/"
can be used at the same time.

Regards John

=== Air Code ====================
Private Sub Form_Current()
ProtectControls Me.Protect
End Sub

Private Sub Protect_Click()
If Me.Protect Then
' Ask the user before removing protected status
'
Dim chk As Long
chk = MsgBox( "If You Un-Protect This Animal" & vbNewLine & _
"You May Accidentally Erase Information That Could " & _
"Cause Data To Be Displayed Incorrectly!" & vbNewLine &
vbNewLine & _
"Are You Sure You Want To Un-Protect ( " & [AnimalName] & " ) At
This Time?", _
vbYesNo + vbCritical, "Un-Protect?")
If chk <> vbYes Then
Exit Sub
End If
End If

Call ProtectControls(Not Me.Protect)

End Sub

Private Sub ProtectControls(DoProtect As Boolean)
On Error Goto Err_Handle
' Putting /Protect/ in the tag property of a control will enable
' this code to work without having to change the list of controls
' as in your original code
'
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag Like "*/Protect/*" Then
ctl.Locked = DoProtect
ctl.Enabled = Not DoProtect
End If
Next 'ctl

Exit Sub
Err_Handle:

End Sub

Alvin said:
Thank you Rick,
I got it working and I do have code in the current event of the Form. Here
is how I did it. You'll se I added a requery for my option Group
"Protect.Requery".

-------------This code is in the on click event of my options
Group-------------
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
Protect.Requery

End Sub
-----------------End Code-------------------------------


This code is in the oncurrent event of the form
----------------Code Start------------------------------
Private Sub Form_Current()
If Me.Protect = True Then
Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False

Else
If Me.Protect = False Then
Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True

End If
End If
End Sub
-----------------------Code End---------------------------

Rick B said:
One note, you need to also include this code in your form's CURRENT event.
Otherwise, it will not check the field and update the status of the controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do this
if they change an existing record? Not really sure how you would control
this. Once they start editing you want to force them to stay on the record?

--
Rick B



Alvin said:
I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.


Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
DoCmd.Requery

End Sub
 
A

Alvin

John,
I Like the Idea but I am very new to vbcode and am totaly self taught. I've
only been doing this for three months. I'm not sure how to incoorperate this
in the database.
Thanks for the help
Alvin

John Griffiths said:
Hi Alvin

You can reduce the amount of coding for
a list of controls to be affected in a systematic way by
writing a sub routine to do the donkey work.

ie Keeping the various lists from [AnimalName] to [Notes] in sequence
across a whole project can be arduous and error prone.
I've put "/" around the value in the Tag property so that other
information can be added such as "/Colorable/" or "/Hideable/"
can be used at the same time.

Regards John

=== Air Code ====================
Private Sub Form_Current()
ProtectControls Me.Protect
End Sub

Private Sub Protect_Click()
If Me.Protect Then
' Ask the user before removing protected status
'
Dim chk As Long
chk = MsgBox( "If You Un-Protect This Animal" & vbNewLine & _
"You May Accidentally Erase Information That Could " & _
"Cause Data To Be Displayed Incorrectly!" & vbNewLine &
vbNewLine & _
"Are You Sure You Want To Un-Protect ( " & [AnimalName] & " ) At
This Time?", _
vbYesNo + vbCritical, "Un-Protect?")
If chk <> vbYes Then
Exit Sub
End If
End If

Call ProtectControls(Not Me.Protect)

End Sub

Private Sub ProtectControls(DoProtect As Boolean)
On Error Goto Err_Handle
' Putting /Protect/ in the tag property of a control will enable
' this code to work without having to change the list of controls
' as in your original code
'
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag Like "*/Protect/*" Then
ctl.Locked = DoProtect
ctl.Enabled = Not DoProtect
End If
Next 'ctl

Exit Sub
Err_Handle:

End Sub

Alvin said:
Thank you Rick,
I got it working and I do have code in the current event of the Form. Here
is how I did it. You'll se I added a requery for my option Group
"Protect.Requery".

-------------This code is in the on click event of my options
Group-------------
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
Protect.Requery

End Sub
-----------------End Code-------------------------------


This code is in the oncurrent event of the form
----------------Code Start------------------------------
Private Sub Form_Current()
If Me.Protect = True Then
Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False

Else
If Me.Protect = False Then
Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True

End If
End If
End Sub
-----------------------Code End---------------------------

Rick B said:
One note, you need to also include this code in your form's CURRENT event.
Otherwise, it will not check the field and update the status of the controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do this
if they change an existing record? Not really sure how you would control
this. Once they start editing you want to force them to stay on the record?

--
Rick B



I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing
info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.


Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) &
"You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This
 
A

Alvin

I've Copy and pasted the code and I get the message box to appear but it
isn't Locking the controles.
I'm missing something somewhere.
Thanks for the help.
Alvin



Alvin said:
John,
I Like the Idea but I am very new to vbcode and am totaly self taught. I've
only been doing this for three months. I'm not sure how to incoorperate this
in the database.
Thanks for the help
Alvin

John Griffiths said:
Hi Alvin

You can reduce the amount of coding for
a list of controls to be affected in a systematic way by
writing a sub routine to do the donkey work.

ie Keeping the various lists from [AnimalName] to [Notes] in sequence
across a whole project can be arduous and error prone.
I've put "/" around the value in the Tag property so that other
information can be added such as "/Colorable/" or "/Hideable/"
can be used at the same time.

Regards John

=== Air Code ====================
Private Sub Form_Current()
ProtectControls Me.Protect
End Sub

Private Sub Protect_Click()
If Me.Protect Then
' Ask the user before removing protected status
'
Dim chk As Long
chk = MsgBox( "If You Un-Protect This Animal" & vbNewLine & _
"You May Accidentally Erase Information That Could " & _
"Cause Data To Be Displayed Incorrectly!" & vbNewLine &
vbNewLine & _
"Are You Sure You Want To Un-Protect ( " & [AnimalName] & " ) At
This Time?", _
vbYesNo + vbCritical, "Un-Protect?")
If chk <> vbYes Then
Exit Sub
End If
End If

Call ProtectControls(Not Me.Protect)

End Sub

Private Sub ProtectControls(DoProtect As Boolean)
On Error Goto Err_Handle
' Putting /Protect/ in the tag property of a control will enable
' this code to work without having to change the list of controls
' as in your original code
'
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag Like "*/Protect/*" Then
ctl.Locked = DoProtect
ctl.Enabled = Not DoProtect
End If
Next 'ctl

Exit Sub
Err_Handle:

End Sub

Alvin said:
Thank you Rick,
I got it working and I do have code in the current event of the Form. Here
is how I did it. You'll se I added a requery for my option Group
"Protect.Requery".

-------------This code is in the on click event of my options
Group-------------
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) & "You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On Protect",
vbCritical, "Un-Protect?"

End If
End If
Protect.Requery

End Sub
-----------------End Code-------------------------------


This code is in the oncurrent event of the form
----------------Code Start------------------------------
Private Sub Form_Current()
If Me.Protect = True Then
Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False

Else
If Me.Protect = False Then
Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True

End If
End If
End Sub
-----------------------Code End---------------------------

:

One note, you need to also include this code in your form's CURRENT event.
Otherwise, it will not check the field and update the status of the controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do this
if they change an existing record? Not really sure how you would control
this. Once they start editing you want to force them to stay on the record?

--
Rick B



I want the user to be able to click a protect option that will dissable
controls on that form. Then un-protect if they need to upadate missing
info.
The only reason for this is so they will be focused on what they are doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first record.
They need to stay with that record until they are finished updating it so
they can click protect again.
Here is my code.


Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
 
J

John Griffiths

Hi Alvin

I'm glad my air code didn't give you any errors you couldn't cope with.

Part of my reasons for my post was to show other ways of working as
well as reducing your workload.

Note the controls that were locked had some text put in a property called
Tag.

This property is provided across vb controls as a way for developers to
store any information they need to make their design work with a value
held in the control.

The alternative is that you would have to keep parallel arrays/collections
and maintain them as well.

I hope someone was able to help in my absence from the ng.

HTH John


Alvin said:
I've Copy and pasted the code and I get the message box to appear but it
isn't Locking the controles.
I'm missing something somewhere.
Thanks for the help.
Alvin



Alvin said:
John,
I Like the Idea but I am very new to vbcode and am totaly self taught. I've
only been doing this for three months. I'm not sure how to incoorperate this
in the database.
Thanks for the help
Alvin

John Griffiths said:
Hi Alvin

You can reduce the amount of coding for
a list of controls to be affected in a systematic way by
writing a sub routine to do the donkey work.

ie Keeping the various lists from [AnimalName] to [Notes] in sequence
across a whole project can be arduous and error prone.
I've put "/" around the value in the Tag property so that other
information can be added such as "/Colorable/" or "/Hideable/"
can be used at the same time.

Regards John

=== Air Code ====================
Private Sub Form_Current()
ProtectControls Me.Protect
End Sub

Private Sub Protect_Click()
If Me.Protect Then
' Ask the user before removing protected status
'
Dim chk As Long
chk = MsgBox( "If You Un-Protect This Animal" & vbNewLine & _
"You May Accidentally Erase Information That Could " & _
"Cause Data To Be Displayed Incorrectly!" & vbNewLine &
vbNewLine & _
"Are You Sure You Want To Un-Protect ( " & [AnimalName] & " ) At
This Time?", _
vbYesNo + vbCritical, "Un-Protect?")
If chk <> vbYes Then
Exit Sub
End If
End If

Call ProtectControls(Not Me.Protect)

End Sub

Private Sub ProtectControls(DoProtect As Boolean)
On Error Goto Err_Handle
' Putting /Protect/ in the tag property of a control will enable
' this code to work without having to change the list of controls
' as in your original code
'
Dim ctl As Control
For Each ctl In Me.Controls
If ctl.Tag Like "*/Protect/*" Then
ctl.Locked = DoProtect
ctl.Enabled = Not DoProtect
End If
Next 'ctl

Exit Sub
Err_Handle:

End Sub

Thank you Rick,
I got it working and I do have code in the current event of the Form. Here
is how I did it. You'll se I added a requery for my option Group
"Protect.Requery".

-------------This code is in the on click event of my options
Group-------------
Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation, "Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True
MsgBox "If You Un-Protect This Animal" & Chr(13) & Chr(10) & Chr(10) &
"You
May Accidently Erase Information That Could Cause Data To Be Displayed
Incorrectly!" & Chr(13) & Chr(10) & Chr(10) & "Are You Sure You Want To
Un-Protect ( " & [Form_Add Male Breeders]![AnimalName] & " ) At This
Time?" &
Chr(13) & Chr(10) & Chr(10) & "If Not! After You Click OK Click On
Protect",
vbCritical, "Un-Protect?"

End If
End If
Protect.Requery

End Sub
-----------------End Code-------------------------------


This code is in the oncurrent event of the form
----------------Code Start------------------------------
Private Sub Form_Current()
If Me.Protect = True Then
Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False

Else
If Me.Protect = False Then
Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
Me.cboFather.Enabled = True
Me.Notes.Locked = False
Me.Notes.Enabled = True

End If
End If
End Sub
-----------------------Code End---------------------------

:

One note, you need to also include this code in your form's CURRENT
event.
Otherwise, it will not check the field and update the status of the
controls
as you scroll from one record to the next. If you "unprotect" a record,
then start scrolling, all the fields will be unlocked unless you include
code in your CURRENT event.

As far as your actual question, if the user moves to the next record (by
pressing PG DOWN or TAB) you want to stop them? Do you only want to do
this
if they change an existing record? Not really sure how you would
control
this. Once they start editing you want to force them to stay on the
record?

--
Rick B



I want the user to be able to click a protect option that will
dissable
controls on that form. Then un-protect if they need to upadate missing
info.
The only reason for this is so they will be focused on what they are
doing
when changing data. the only problem is after clicking either option
"Protect" or "UnProtect" the requery takes them back to the first
record.
They need to stay with that record until they are finished updating it
so
they can click protect again.
Here is my code.


Private Sub Protect_Click()
If Me.Protect = True Then

Me.AnimalName.Locked = True
Me.AnimalName.Enabled = False
Me.CageNumber.Locked = True
Me.CageNumber.Enabled = False
Me.Breed.Locked = True
Me.Breed.Enabled = False
Me.Cost.Locked = True
Me.Cost.Enabled = False
Me.SoldFor.Locked = True
Me.SoldFor.Enabled = False
Me.DateAquired.Locked = True
Me.DateAquired.Enabled = False
Me.DateSold.Locked = True
Me.DateSold.Enabled = False
Me.Birthday.Locked = True
Me.Birthday.Enabled = False
Me.CcboMother.Locked = True
Me.CcboMother.Enabled = False
Me.cboFather.Locked = True
Me.cboFather.Enabled = False
Me.Notes.Locked = True
Me.Notes.Enabled = False
MsgBox "You Have Succesfully Protected ( " & [Form_Add Male
Breeders]![AnimalName] & " ) At This Time?", vbInformation,
"Protection
Succefull!"

Else
If Me.Protect = False Then


Me.AnimalName.Locked = False
Me.AnimalName.Enabled = True
Me.CageNumber.Locked = False
Me.CageNumber.Enabled = True
Me.Breed.Locked = False
Me.Breed.Enabled = True
Me.Cost.Locked = False
Me.Cost.Enabled = True
Me.SoldFor.Locked = False
Me.SoldFor.Enabled = True
Me.DateAquired.Locked = False
Me.DateAquired.Enabled = True
Me.DateSold.Locked = False
Me.DateSold.Enabled = True
Me.Birthday.Locked = False
Me.Birthday.Enabled = True
Me.CcboMother.Locked = False
Me.CcboMother.Enabled = True
Me.cboFather.Locked = False
 
Top