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
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