I was going to focus on the machine that I am on and then worry about distributing it. Here is the current code that controls the calander function.
Where can I find the date picker control? Thanks.
Option Explicit
Dim DataSource As String
Dim DataRow As Integer
Const UNSUCC As String = "Closed-Unsuccessful"
Const FUTURE As String = "Closed-Future Prospect"
Const START As String = "StartDate"
Const COMMIT As String = "CommitDate"
Const NoteDate As String = "NoteDate"
Const NOBID As String = "Closed-No bid"
Const SUCC As String = "Closed-Successful"
Const OppOPEN As String = "Open"
Public Property Let Source(val As String)
DataSource = val
End Property
Private Sub UserForm_Initialize()
Calendar1.Value = Sheets("Validations").Range("N2").Value
Calendar1.TitleFont.Bold = False
Calendar1.TitleFont.Size = 10
End Sub
Private Sub Calendar1_Click()
Dim ValidDate As Boolean
Select Case DataSource
Case FUTURE, UNSUCC, OppOPEN, SUCC
ValidDate = (Calendar1.Value > Date)
If Not ValidDate Then
MsgBox "Please set a Followup Date in the future"
End If
Case NOBID
ValidDate = (Calendar1.Value > Date)
If Not ValidDate Then
MsgBox "You must set a Date in the future, for Closed-No Bid"
End If
Case START, COMMIT
ValidDate = True
Select Case DataSource
Case START
If Calendar1.Value > Date Then
ValidDate = False
MsgBox "You may not set a Start Date in the Future", vbCritical, "Invalid Opportunity Start Date"
End If
Case COMMIT
ValidDate = (Calendar1.Value >= CDate(frmOpportunity.StartDate))
If Not ValidDate Then
MsgBox "Please set the Commit Date AFTER the Start Date", vbCritical, "InValid Opportunity Commit Date"
End If
End Select
Case NoteDate
ValidDate = (Calendar1.Value <= Date)
If Not ValidDate Then
MsgBox "You may not date a Note in the Future", vbCritical, "Invalid Note Date"
End If
End Select
If ValidDate Then
Select Case DataSource
Case START, COMMIT
Select Case DataSource
Case START
frmOpportunity.StartDate = CStr(Calendar1.Value)
Case COMMIT
frmOpportunity.CommitDate = CStr(Calendar1.Value)
End Select
Case NoteDate
frmOpportunity.NoteDate = CStr(Calendar1.Value)
Case FUTURE, NOBID, UNSUCC, OppOPEN, SUCC
UserForm11.FollowupDate = CStr(Calendar1.Value)
End Select
End If
Unload Me
End Sub
Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
Select Case DataSource
Case FUTURE
If Calendar1.Value <= Date Then
' A FUTURE Date must be provided for Closed-Future Prospect
Cancel = 1
MsgBox "You must set a FollowUp Date in the future for this type of Closure action"
End If
Case START
If Calendar1.Value > Date Then
' A FUTURE Date must be provided for Opportunity Start Date
Cancel = 1
MsgBox "You must set a Start Date which is not in the Future"
End If
End Select
End Sub
Bookmarks