Change Calender Start date

B

Bob V

I want to have the start date [tbDateFrom] to start from this code:
Me!tbDateFrom = DateSerial(Year(Date), Month(Date) - 1, 7)
Is this possible?.....Thanks for any Help............Bob

Private Sub cmdCalenderTo_Click()
DoCmd.Close acForm, "frmCalender"
iccCalender (Now)
If Len(Forms!frmCalender![tbDate]) = 0 Then
Exit Sub
Else
tbDateTo.value = Format(Forms!frmCalender![tbDate], "dd-mmm-yyyy")
End If

Dim nDateDiff As Integer, nSign As Integer
nDateDiff = DateDiff("d", CDate(tbDateFrom.value),
CDate(tbDateTo.value))
nSign = Sgn(nDateDiff)

Select Case Me.OpenArgs

Case "OwnerStatement"
If nSign = -1 Or nSign = 0 Then
MsgBox "Please Select Date In Proper Range.",
vbApplicationModal + vbExclamation + vbOKOnly
cmdCalenderTo.SetFocus
cbOwnerName.Enabled = False
Exit Sub
End If
cbOwnerName.Enabled = True

Case Else

If nSign = -1 Or nSign = 0 Then
MsgBox "Please Select Date In Proper Range.",
vbApplicationModal + vbExclamation + vbOKOnly
cmdCalenderTo.SetFocus
cbOwnerName.Enabled = False
Exit Sub
End If
cbOwnerName.Enabled = True

End Select

End Sub
 
B

Bob V

Oops sorry This is the code!!!!
I want to add this to my code
If [ckb7] = -1
Me!tbDateFrom = DateSerial(Year(Date), Month(Date) - 1, 7)
Is this possible?.....Thanks for any Help............Bob

Private Sub Form_Open(Cancel As Integer)

Select Case Me.OpenArgs

Case "OwnerStatement"

Me.Caption = "Owner Statement"

tbDateFrom.value = Format("01-" & Month(Now) & "-" & Year(Now),
"dd-mmm-yyyy")
tbDateTo.value = Format(Now, "dd-mmm-yyyy")
 

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