doran_doran
Registered User.
- Local time
- Yesterday, 20:37
- Joined
- Aug 15, 2002
- Messages
- 349
Can anyone verify my code...
Purpose:
======
1. Force users not put a back date than today.
2. Force users to put 25day of the month but if today's date is 4/28/04 then they should enter a future date that is either 05/25/2004 or 06/25/2004. If today's date is 4/23 then users can put 04/25/2004.
Error:
=====
The following code is erroring on following line
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
so I changed it to below
Me.txtInvoiceBillDate = CDate(Month(Date()) & "/25/" & Year(Date()))
But still not working.
Thanks
Dianna
The Code I am using
=======================================================
Private Sub txtInvoiceBillDate_BeforeUpdate()
Dim vTempDate As Variant
Select Case CDate(Me.txtInvoiceBillDate)
Case Is < Date
If Day(Date) < 25 Then
vTempDate = DateAdd("m", 1, me.txtInvoiceBillDate)
Me.txtInvoiceBillDate= CDate(Month(vTempDate) & "/25/" & Year(vTempDate))
Else
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
End If
Case Is > Date
If Day(Me.txtInvoiceBillDate) <= 25 Then
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
Else
vTempDate = DateAdd("m", 1, me.txtInvoiceBillDate)
Me.txtInvoiceBillDate= CDate(Month(vTempDate) & "/25/" & Year(vTempDate))
End If
End Select
End Sub
Purpose:
======
1. Force users not put a back date than today.
2. Force users to put 25day of the month but if today's date is 4/28/04 then they should enter a future date that is either 05/25/2004 or 06/25/2004. If today's date is 4/23 then users can put 04/25/2004.
Error:
=====
The following code is erroring on following line
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
so I changed it to below
Me.txtInvoiceBillDate = CDate(Month(Date()) & "/25/" & Year(Date()))
But still not working.
Thanks
Dianna
The Code I am using
=======================================================
Private Sub txtInvoiceBillDate_BeforeUpdate()
Dim vTempDate As Variant
Select Case CDate(Me.txtInvoiceBillDate)
Case Is < Date
If Day(Date) < 25 Then
vTempDate = DateAdd("m", 1, me.txtInvoiceBillDate)
Me.txtInvoiceBillDate= CDate(Month(vTempDate) & "/25/" & Year(vTempDate))
Else
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
End If
Case Is > Date
If Day(Me.txtInvoiceBillDate) <= 25 Then
Me.txtInvoiceBillDate= CDate(Month(Date) & "/25/" & Year(Date))
Else
vTempDate = DateAdd("m", 1, me.txtInvoiceBillDate)
Me.txtInvoiceBillDate= CDate(Month(vTempDate) & "/25/" & Year(vTempDate))
End If
End Select
End Sub
Last edited: