DJ_DEF_CON_1
Registered User.
- Local time
- Today, 05:23
- Joined
- Jan 1, 2003
- Messages
- 40
Good day,
The following code is filling in my text boxes with 12/01/1898 and 12/31/1898. It is only supposed to give me, when I select the month from my combo box the dates of the month from last year. Does any one know how to re-work the code.
Thanks
Private Sub Combo2_AfterUpdate()
Dim aDate As Date
If Me.Combo2 > Month(Date) Then
'now the year needs to be corrected
Me.START_DATE = DateSerial(Year(aDate) - 1, Month(aDate), "01")
'the "00" will force the month's last day, but the month must be set to +1 !
Me.END_DATE = DateSerial(Year(aDate) - 1, Month(aDate) + 1, "00")
Else
Me.START_DATE = DateSerial(Year(aDate), Month(aDate), "01")
'the "00" will force the month's last day, but the month must be set to +1 !
Me.END_DATE = DateSerial(Year(aDate), Month(aDate) + 1, "00")
End If
End Sub
The following code is filling in my text boxes with 12/01/1898 and 12/31/1898. It is only supposed to give me, when I select the month from my combo box the dates of the month from last year. Does any one know how to re-work the code.
Thanks
Private Sub Combo2_AfterUpdate()
Dim aDate As Date
If Me.Combo2 > Month(Date) Then
'now the year needs to be corrected
Me.START_DATE = DateSerial(Year(aDate) - 1, Month(aDate), "01")
'the "00" will force the month's last day, but the month must be set to +1 !
Me.END_DATE = DateSerial(Year(aDate) - 1, Month(aDate) + 1, "00")
Else
Me.START_DATE = DateSerial(Year(aDate), Month(aDate), "01")
'the "00" will force the month's last day, but the month must be set to +1 !
Me.END_DATE = DateSerial(Year(aDate), Month(aDate) + 1, "00")
End If
End Sub