Cancel out of calendar control

M

maryj

I have a calendar control on a form. The field that is associated with this
control is not a required field and can be left blank. However, once the
combo box is selected and the calendar is displayed, I have not found a way
to cancel the calendar without it filling in a date. Here is the code that I
currently have:
ocxCalendar.Visible = True
ocxCalendar.SetFocus
If Not IsNull(cboStartDate) Then
ocxCalendar.Value = cboStartDate.Value
Else
ocxCalendar.Value = Date
End If

Is there something that can be added to allow no date to be selected?
Thanks!
 
N

NetworkTrade

in the calendar form - go to its Form Properties....one of these is "Close
Button" and the default may be 'no'...

if you change this to 'yes'....then I think then the user can select a close
option

although I'm not sure as I haven't used this before.....
 
M

maryj

Thanks, but I don't see that property for a calendar control. We tried
changing the ValueIsNull property from No to Yes, but then it displays
12:00:00.

Any other suggestions?
 
N

NetworkTrade

the calendar in Access is an ActiveX Control applied to a blank Form....so
there should be a Form in your Form Objects area that is that calendar.

(an Access naming convention would be actlCalendar -- but many coders don't
follow this convention)

Find it, highlight it, and select Design View

and then in the upper left corner of that form is a little black
square....right click on that and select 'Properties'
 
M

maryj

The only form I see is the form with the other fields which the Calendar
control is part of. Is tht the form you are referring to? If so, we don't
want to totally close out of that form, we just want to cancel out of the
control without it entering a date in the field.

Thanks again!
 
N

NetworkTrade

no - the way I know calendars is that it is it's own stand alone form - which
pops-up when you link it to a specific text box in another form....(sort of
like a subform)....but it is view-able in the Forms area as its own little
form....

so I am a little baffled as to why your calendar is not showing as a Form

on the other hand - the off-the-cuff advice I gave you on trying to change
the property to include a Close Box - doesn't work - as I just tested it on a
test db.....

If it was a form then you could put the close form macro upon the Exit event
of that text box - which would/should close that calendar "form"

I relooked at your code and I see you have: ocxCalendar.Visible

so it would seem to that the object's name is ocxCalendar. Can you add an
ocxCalendar.close ? you might experiment with that
 

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