oxicottin
Learning by pecking away....
- Local time
- Yesterday, 21:36
- Joined
- Jun 26, 2007
- Messages
- 851
Hello, I have a SQL that works but with one fault. If there isn't any records for dteCompleted then it disables the button and if there is records it enables them. The issue I'm having is if in my qryEmployeeRequirements there is one record that doesn't have a result the button still is enabled when I need it disabled. What needs added to VBA to accommodate for that?
Code:
Public Function RstButton()
'Show/ Hide print button
Dim dteCompleted As Variant
Dim strCriteria As String
strCriteria = "EmpID = " & Forms!frmFunctionalDataEntry!frmRequirementsSubform.Form!EmpID & " And FuncID = " & Forms!frmFunctionalDataEntry!frmRequirementsSubform.Form!FuncID
dteCompleted = DLookup("DateCompleted", "qryEmployeeRequirements", strCriteria)
If (Not IsNull(dteCompleted)) Then
Forms!frmFunctionalDataEntry!cmdPrintFunction.Caption = "Print completed " & Forms!frmFunctionalDataEntry!lstArea.Column(1) & " report."
Forms!frmFunctionalDataEntry!cmdPrintFunction.Visible = True
Forms!frmFunctionalDataEntry!cmdPrintFunction.Enabled = True
End If
If (IsNull(dteCompleted)) Then
Forms!frmFunctionalDataEntry!cmdPrintFunction.Visible = True
Forms!frmFunctionalDataEntry!cmdPrintFunction.Caption = "Function Not Complete, Printing disabled"
Forms!frmFunctionalDataEntry!cmdPrintFunction.Enabled = False
End If
End Function