Calendar Control always returns 2005 no matter what

T

Trotsky

Hi All,
I have a calendar (Calendar Control 11) on my form to enable users to
click on a date to enter it into a Text Box called startDate. The
calendar is made visible by clicking on a command button (command18).
The trouble is it always returns the year as 2005 no matter what I click
on.

I use this code to call the calendar:

Private Sub Command18_Click()
Calendar1.Visible = True
Calendar1.SetFocus
If Not IsNull(startdate) Then
Calendar1.Value = startdate.Value
Else
Calendar1.Value = Date
End If
End Sub

And when users click on a date this code sends it to the text box

Private Sub Calendar1_Click()
startdate.Value = Calendar1.Value
startdate.SetFocus
Calendar1.Visible = False
End Sub

The text box then passes the date to a query via
=Forms!Breakthrutimeperclient.Requery

Can anyone see where I've went wrong?
I use Access 2003 on XP
TIA
John
 
R

Rob Parker

This might not be much help at all, but you don't seem to be swamped with
replies, so here goes ...

I don't have A2003, or Calendar Control 11, but in A97 and A2000, with
Calendar Controls 9 and 10, I don't have any problem at all with the code
you posted. Well, I haven't actually tested the Requery bit, but all the
rest is OK.

I'm assuming that you've got Month/Year selectors enabled in the control so
that you can change the year. In earlier versions, the one setting
enabled/disabled both month and year drop-downs in the calendar; I guess
it's the same in V11, but maybe ... If you don't have, then you'll always
have the year of the previous entry in the startdate textbox.

Rob
 

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