VBA- Calendar Control Click Event W Specific Select Case requirements

M

Mark

I am developing a VBA form for persons to load travel
trips into as a budget management tool. Here is problem.
The user clicks on a sp control to input a dollar amount
in a synchronized text box. He then clicks on the calendar
control and gets the Msgbox txt defined below. If he
clicks on yes I need the data to be loaded into specific
columns based on the date. If he settles his travel in Jan
then I want the settlement date and Per Diem maounts to be
loaded into the Jan columns only. The code works so far
for Jan only Calendar2.Values. I am looking for a way to
verify the date is within the a specified time period and
then I should be able to If the date validation process to
the correct column/row. I have tried a > < syntax but the
second operator always drives a error MsgBox.

I am open to recoding processes but the intent is to
ensure that the settlement date calendar contol drops the
data into the correct Month column as persons input their
settled travel payments into the GUI.



Private Sub Calendar2_Click()

YesNoTab = MsgBox("Do you want to enter this date" & Chr
(13) _
& "as your settlement date?", vbYesNo + vbQuestion +
vbDefaultButton1, "MAJ S-TDY Settlement Date")

If YesNoTab = 6 Then
Me.lblSettleDate.Caption = Calendar2.Value


'Validate January 04 date to be dumped into
Jaunry's cell
If Calendar2.Value > "12/31/2004" Then

Select Case TabStrip1.Value
Case 0
Range("N" & IndexPlus).Value = txtPerDiem.Value
Range("Q" & IndexPlus).Value =
lblSettleDate.Caption
End Select
End If



'Validate February 04 date to be dumped into
February's cell
If Calendar2.Value > "01/31/2004" Then
Select Case TabStrip1.Value
Case 1
Range("S" & IndexPlus).Value = txtPerDiem.Value
Range("V" & IndexPlus).Value =
lblSettleDate.Caption
End Select
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top