On my Contract form I have a button (ButtonOpenProject1) that opens the project form based on the projectID in the current form.
I made a change to the project form to help control the input of data. That change included placing some of the objects to Enable = False on the form.
Now I'm trying to fix my ButtonOpenProject1 since when I click it, those objects are not enabled, even though all the require fields are completed.
ValidationOfControl is a module that checks is if specific fields are populated. If they are not populated is returns True. If all of the required fields are populated, it returns False.
Here's my code for the ButtonOpenProject1
What am I missing here?
When the button is pressed, it opens the form but all the objects shown in the code above are not enabled, even though they should be because ValidationOfControl should be returning false.
I made a change to the project form to help control the input of data. That change included placing some of the objects to Enable = False on the form.
Now I'm trying to fix my ButtonOpenProject1 since when I click it, those objects are not enabled, even though all the require fields are completed.
ValidationOfControl is a module that checks is if specific fields are populated. If they are not populated is returns True. If all of the required fields are populated, it returns False.
Here's my code for the ButtonOpenProject1
Code:
Private Sub ButtonOpenProject1_Click()
On Error GoTo ButtonOpenProject1_Click_Err
DoCmd.OpenForm "F_Project", acNormal, "", "[ProjectID]=" & ProjectID, , acNormal
ButtonOpenProject1_Click_Exit:
Exit Sub
ButtonOpenProject1_Click_Err:
MsgBox "You have to select a Project first, to Open it."
Resume ButtonOpenProject1_Click_Exit
'ValidationOfControl = True when certain fields are not populated
'When F_Project is opened with this button, these fields should have already been populated.
If ValidationOfControl(Form) = False Then
With Forms!F_Project.Form
.cboProjectFY.Enabled = True
.cboProjectType.Enabled = True
.cboFundingType.Enabled = True
.CheckPSD.Enabled = True
.CheckNEPA.Enabled = True
.CheckActive.Enabled = True
.CheckActiveAwarded.Enabled = True
.CheckActiveContractor.Enabled = True
.CheckCloseOutProject.Enabled = True
.txtEstimate.Enabled = True
.txtProjectPriority.Enabled = True
.txtDateCreated.Enabled = True
.SF_Contract.Enabled = True
.TabCtProjects.Enabled = True
End With
End If
End Sub
What am I missing here?
When the button is pressed, it opens the form but all the objects shown in the code above are not enabled, even though they should be because ValidationOfControl should be returning false.