Hoping someone can help.
I have a number of checklists in my database which I have built using the fab tutorials from Nifty Access. All my forms have the fields disabled until the user edits this record via the click of a command button. I've included this to prevent unintentional editing and to make it clearer to the user which fields they can and cannot edit.
With this in mind, the controls which contain the checklist subforms are also disabled until the edit command button is clicked when the use can then check whichever boxes they need. However, there's one of my checklists that doesn't enable when the edit command button is clicked. The code behind the button is below:
The strange thing is that the
I did wonder if it was due to the other code included in the on click event but the above line of code actually works in a previous copy of the database and the only addition in this set of code is the
This works fine too when the edit button is clicked and it's also very similar to the other code in the version of the database that works so I'm a little stumped.
Hope someone can help.
Kind regards
Allison
I have a number of checklists in my database which I have built using the fab tutorials from Nifty Access. All my forms have the fields disabled until the user edits this record via the click of a command button. I've included this to prevent unintentional editing and to make it clearer to the user which fields they can and cannot edit.
With this in mind, the controls which contain the checklist subforms are also disabled until the edit command button is clicked when the use can then check whichever boxes they need. However, there's one of my checklists that doesn't enable when the edit command button is clicked. The code behind the button is below:
Code:
Private Sub Edit_Click()
On Error GoTo ErrorHandler
EditForm Me
Me.GrantOutcomesDataSubWindow.Form!Selected.Enabled = True
AssessmentFields Me
'Enables payment fields if payment not yet authorised
If Me.Recommendation = "Approval" And IsNull(Me.FirstAuthorisation) Then
Me.AccountName.Enabled = True
Me.AccountNumber.Enabled = True
Me.SortCode.Enabled = True
Me.BuildingSocietyRef.Enabled = True
End If
'If payment has been authorised but not paid, enable payment date control and save button
If IsNull(Me.PaymentDate) And Not IsNull(Me.FinalAuthorisationDate) And _
Me.Recommendation = "Approval" Then
Me.PaymentDate.Enabled = True
Me.SavePayDate.Enabled = True
End If
'enables null payment authorisation fields only depending on user
If Forms![homepagef]!AccessID = 1 Or Forms![homepagef]!AccessID = 2 Then
If Me.Recommendation = "Approval" Then
If IsNull(Me.FirstAuthorisation) Then
If IsNull(Me.FirstAuthorisationDate) Then
If IsNull(Me.FinalAuthorisation) Then
Me.FirstAuthorisation.Enabled = True
Me.FirstAuthorisationDate.Enabled = True
Me.FinalAuthorisation.Enabled = True
Me.SaveFirstAuth.Enabled = True
End If
End If
End If
End If
End If
'enables null final authorisation fields only dependent on user
If Forms![homepagef]!AccessID = 5 Or Forms![homepagef]!AccessID = 1 Then
If Me.Recommendation = "Approval" Then
If IsNull(Me.FinalAuthorisationDate) Then
Me.FinalAuthorisationDate.Enabled = True
Me.SaveFinalAuth.Enabled = True
End If
End If
End If
'enables SMT approval fields if funding requested is up to £2k
If Me.Programme = "Wales fast track" Or Me.Programme = "Wales kit grants" _
Or Me.Programme = "England £2K" Then
If Forms![homepagef]!AccessID = 5 Then
If IsNull(Me.SMTApprovedBy) Then
If IsNull(Me.ApprovalDate) Then
Me.SMTApprovedBy.Enabled = True
Me.ApprovalDate.Enabled = True
Me.TrusteeApproval.Enabled = False
Me.MinuteReference.Enabled = False
End If
End If
End If
End If
'enables trustee approval fields if funding requested is over £2k
If Me.Programme = "England £10K" Or Me.Programme = "Wales main grants" Then
If Me.TrusteeApproval = 0 Then
If IsNull(Me.MinuteReference) Then
Me.TrusteeApproval.Enabled = True
Me.MinuteReference.Enabled = True
Me.SMTApprovedBy.Enabled = False
Me.ApprovalDate.Enabled = True
End If
End If
End If
Exit Sub
ErrorHandler:
Dim msg As String
msg = Err.Number & ":" & Err.Description
MsgBox msg
End Sub
The strange thing is that the
Me.GrantOutcomesDataSubWindow.Form!Selected.Enabled = True
line of code is exactly the same (with the exception of the name of the sub window controls) in another form with another 4 checklists and this works perfectly. I did wonder if it was due to the other code included in the on click event but the above line of code actually works in a previous copy of the database and the only addition in this set of code is the
AssessmentFields Me
line which calls this module:
Code:
Public Sub AssessmentFields(frm As Access.Form)
If frm.Programme = "England £10K" Then
frm.MainGrants.Enabled = False
frm.StateAid.Enabled = False
frm.Sustainability.Enabled = False
frm.SustainabilityScore.Enabled = False
frm.ManagementDeliverability.Enabled = False
frm.MDScore.Enabled = False
frm.Risk.Enabled = False
frm.RiskScore.Enabled = False
End If
If frm.Programme = "England £2K" Then
frm.MainGrants.Enabled = False
frm.StateAid.Enabled = False
frm.AreaScore.Enabled = False
frm.Sustainability.Enabled = False
frm.SustainabilityScore.Enabled = False
frm.ManagementDeliverability.Enabled = False
frm.MDScore.Enabled = False
frm.Risk.Enabled = False
frm.RiskScore.Enabled = False
End If
End Sub
This works fine too when the edit button is clicked and it's also very similar to the other code in the version of the database that works so I'm a little stumped.
Hope someone can help.
Kind regards
Allison