chthomas
Registered User.
- Local time
- Today, 17:54
- Joined
- Feb 8, 2000
- Messages
- 32
I have a form where there is a date field. When the user double clicks on the date field, a calendar pops up. This is working fine. Now my problem. I should restrict the user to select only the last day of any month (Am using dsum expression for calculating running totals between 2 dates). How can i accompolish this.
Am using the following module for calendar
Function PopupCalendar(ctl As Control) As Variant
'
' This is the public entry point.
' If the passed in date is Null (as it will be if someone just
' opens the Calendar form raw), start on the current day.
' Otherwise, start with the date that is passed in.
'
Dim frmCal As Form
Dim varStartDate As Variant
varStartDate = IIf(IsNull(ctl.value), DATE, ctl.value)
DoCmd.OpenForm CALENDAR_FORM, , , , , A_DIALOG, varStartDate
' You won't get here until the form is closed or hidden.
'
' If the form is still loaded, then get the final chosen date
' from the form. If it isn't, return Null.
'
If isFormLoaded(CALENDAR_FORM) Then
Set frmCal = Forms(CALENDAR_FORM)
ctl.value = Format(DateSerial(frmCal!YEAR, frmCal!Month, frmCal!Day), "dd/mm/yyyy")
DoCmd.Close A_FORM, CALENDAR_FORM
Set frmCal = Nothing
End If
End Function
and for calling am using
=PopupCalendar(Screen.ActiveControl)
or is there any alternate way of doing this, like user selects say month name in an additional field, then this date field is filled with the last day of the selected month automatically.
Am using Access2000.
Regards,
Charley
Am using the following module for calendar
Function PopupCalendar(ctl As Control) As Variant
'
' This is the public entry point.
' If the passed in date is Null (as it will be if someone just
' opens the Calendar form raw), start on the current day.
' Otherwise, start with the date that is passed in.
'
Dim frmCal As Form
Dim varStartDate As Variant
varStartDate = IIf(IsNull(ctl.value), DATE, ctl.value)
DoCmd.OpenForm CALENDAR_FORM, , , , , A_DIALOG, varStartDate
' You won't get here until the form is closed or hidden.
'
' If the form is still loaded, then get the final chosen date
' from the form. If it isn't, return Null.
'
If isFormLoaded(CALENDAR_FORM) Then
Set frmCal = Forms(CALENDAR_FORM)
ctl.value = Format(DateSerial(frmCal!YEAR, frmCal!Month, frmCal!Day), "dd/mm/yyyy")
DoCmd.Close A_FORM, CALENDAR_FORM
Set frmCal = Nothing
End If
End Function
and for calling am using
=PopupCalendar(Screen.ActiveControl)
or is there any alternate way of doing this, like user selects say month name in an additional field, then this date field is filled with the last day of the selected month automatically.
Am using Access2000.
Regards,
Charley