Hello,
I wish to call on a Public Function from my Module_General
This is the Function I wish to use:
This is where I am getting the Compile error: I do not know where to put the Call:
Thank you.
I wish to call on a Public Function from my Module_General
This is the Function I wish to use:
Code:
' Check all dates on form to ensure they are not less than the delivery date (TxtCustomerPreferredDate).
Public Function DateCheck(form_name As String)
Dim txtmessage As String
txtmessage = ""
If Forms(form_name).ChkCarcassCut = True Then
If Forms(form_name).ChkCC_Cut = False And Forms(form_name).TxtCarcassCut_Due > Forms(form_name).TxtCustomerPreferredDate Then
txtmessage = "Warning! Delivery/Completion Date cannot be before a process." & vbCrLf & txtmessage
Forms(form_name).TxtCarcassCut_Due.BackColor = vbRed
Forms(form_name).TxtCarcassCut_Due.ForeColor = vbWhite
Forms(form_name).TxtCustomerPreferredDate.BackColor = vbRed
Forms(form_name).TxtCustomerPreferredDate.ForeColor = vbWhite
Forms(form_name).TxtCarcassCut_Due.SetFocus
Else
Forms(form_name).TxtCarcassCut_Due.BackColor = vbWhite
Forms(form_name).TxtCarcassCut_Due.ForeColor = vbBlack
Forms(form_name).TxtCustomerPreferredDate.BackColor = vbWhite
Forms(form_name).TxtCustomerPreferredDate.ForeColor = vbBlack
End If
End If
End Function
This is where I am getting the Compile error: I do not know where to put the Call:
Code:
' Check all fields are complete, check process dates are not later than delivery
Private Sub BtnClose_Click()
If IsNull(CboDeliverPickUp) Then
MsgBox "Please select Delivery or Pick up", , "Missing Details"
CboDeliverPickUp.BackColor = vbRed
CboDeliverPickUp.ForeColor = vbWhite
CboDeliverPickUp.SetFocus
ElseIf IsNull(CboSupplyInstall) Then
MsgBox "Please select Supply or Install", , "Missing Details"
CboSupplyInstall.BackColor = vbRed
CboSupplyInstall.ForeColor = vbWhite
CboSupplyInstall.SetFocus
ElseIf ChkTwoPakPaint = True And IsNull(CboPaintID) Then
MsgBox "Please select paint finish", , "Missing Details"
CboPaintID.BackColor = vbRed
CboPaintID.ForeColor = vbWhite
CboPaintID.SetFocus
ElseIf ChkSkill = True And IsNull(CboSkill) Then
MsgBox "Please select Skilled Labour required", , "Missing Details"
CboSkill.BackColor = vbRed
CboSkill.ForeColor = vbWhite
CboSkill.SetFocus
ElseIf IsNull(TxtCustomerPreferredDate) Then
TxtCustomerPreferredDate.BackColor = vbRed
TxtCustomerPreferredDate.ForeColor = vbWhite
TxtCustomerPreferredDate.SetFocus
Else
CboDeliverPickUp.BackColor = vbWhite
CboDeliverPickUp.ForeColor = vbBlack
CboSupplyInstall.BackColor = vbWhite
CboSupplyInstall.ForeColor = vbBlack
CboPaintID.BackColor = vbWhite
CboPaintID.ForeColor = vbBlack
CboSkill.BackColor = vbWhite
CboSkill.ForeColor = vbBlack
TxtCustomerPreferredDate.BackColor = vbWhite
TxtCustomerPreferredDate.ForeColor = vbBlack
Call DateCheck
DoCmd.Close
End If
End Sub
Thank you.