Problems with Unbound Form with Null Date Fields

  • Thread starter Thread starter Alfred E Newman
  • Start date Start date
A

Alfred E Newman

Hi All,

I have a couple of problems with an unbound form using multiple date
fields that uses Lebans MonthCalendar.

The form has 3 text boxes that open the MonthCalendar and two additional
text boxes that hold the Start date and End date from MonthCalendar and
are set-up as follows:

txtDailyDate - Retrieves a single date on a single click that will be
used to select data for a report. Format Short Date and shows up in the
Daily and Start boxes.

txtWeeklyDate - Retrieves a single date on a single click and has 6 days
added to it. Format Short Date and the selected date shows up in the
Weekly and Start box and the Start date + 6 days shows up in the End box.

txtDateRange - Retrieves a date range with the first day in the Range and
Start boxes and the last day in the End box.

This form also has 2 command buttons - OK and Cancel. OK slects one of
two reports to print and Cancel closes form without a date.

Problem One is how can I use this form for all date inputs. Then
depending on which date field is not null select one of the 2 reports.

Problem Two is how to null the text fields if user selected Daily then
changed their mind and wanted to do a Weekly or Range?

Very much a newbie to VBA so I need a mentor with patience. I have
searched the archives on how to null a date field to no avail. My plan
was to null other two fields when after selecting a date then after
clicking OK have it check the three fields for Not IsNull. However that
is not working to good.

I crossed in two groups because I have read from both about the null
problem. Any help will greatly be appreciated.

Thanks,
Rich
 
The form has 3 text boxes that open the MonthCalendar and two
additional text boxes that hold the Start date and End date from
MonthCalendar and are set-up as follows:

txtDailyDate - Retrieves a single date on a single click that will be
used to select data for a report. Format Short Date and shows up in
the Daily and Start boxes.

txtWeeklyDate - Retrieves a single date on a single click and has 6
days added to it. Format Short Date and the selected date shows up in
the Weekly and Start box and the Start date + 6 days shows up in the
End box.

txtDateRange - Retrieves a date range with the first day in the Range
and Start boxes and the last day in the End box.

This form also has 2 command buttons - OK and Cancel. OK slects one of
two reports to print and Cancel closes form without a date.

Problem One is how can I use this form for all date inputs. Then
depending on which date field is not null select one of the 2 reports.

Problem Two is how to null the text fields if user selected Daily then
changed their mind and wanted to do a Weekly or Range?

Very much a newbie to VBA so I need a mentor with patience. I have
searched the archives on how to null a date field to no avail. My plan
was to null other two fields when after selecting a date then after
clicking OK have it check the three fields for Not IsNull. However
that is not working to good.

I crossed in two groups because I have read from both about the null
problem. Any help will greatly be appreciated.

Thanks,
Rich

I was able to come up with a work around which may have not been the best
way however it does work so I thought I would share.

First I changed the number of command buttons to 3 and made them
"Preview", "Print", and "Cancel".

Then I set-up another hidden unbound control and defaulted it's value to
0. Then depending on which date box I selected, the event I used changed
the value to something for that date box.

Next the user then selects whether to preview or print the correct
report.

Hope this may help someone.

Rich
 
Back
Top