Calendar Control outputting date AND day

grunners22

Registered User.
Local time
Yesterday, 18:31
Joined
Aug 25, 2005
Messages
30
Hi

I'm recently added the CalendarControl 9.0 into some combo boxes in order to quickly input dates - however only the dates are then added, not the day of the week. The day of the week would be really useful if it was visible as the form is outputted to a HTML page for our intranet for other staff to see.

My (relevant) code at the moment is as follows:

-------------------------------------------------

Option Compare Database
Option Explicit
Dim cboOriginator As ComboBox

Private Sub cboStartDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Set cboOriginator = cboStartDate

ocxCalendar.Visible = True
ocxCalendar.SetFocus

If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub

Private Sub cboEndDate_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

Set cboOriginator = cboEndDate

ocxCalendar.Visible = True
ocxCalendar.SetFocus

If Not IsNull(cboOriginator) Then
ocxCalendar.Value = cboOriginator.Value
Else
ocxCalendar.Value = Date
End If
End Sub

Private Sub Form_Load()
ocxCalendar.Visible = False
End Sub

Private Sub ocxCalendar_Click()
cboOriginator.Value = ocxCalendar.Value
cboOriginator.SetFocus
ocxCalendar.Visible = False
Set cboOriginator = Nothing
End Sub

-------------------------------------------

Any help and ideas much appreciated!
 
Change the format to LongDate on the format tab of the ComboBox.
 
I've changed the format to LongDate, but this still doesn't display the actual day. I suspect that this isn't possible using the Calendar Control? Obviously I could add another combo box to the form with the days of the week on it, but then the user would have to use 2 combo boxes to input one date.
 
What do your Regional settings specify for Long Date? Mine have Friday, August 26, 2005.

Or roll your own dddd, MMMM dd, yyyy
 
Last edited:
I've changed them so that they now say dddd, MMMM dd, yyyy

But I am unsure as to how to change the format for the combo box. Where exactly do i need to specify 'LongDate'?

Thanks
 
It is 1st item on the Format tab of the property sheet for the ComboBox.
 
Sorry if I'm seeming stupid but i'm very new to Access.

Every time i put 'LongDate' in that box, it converts it to "Lo"n\gd"ate".

I assume i'm doing something very wrong!
 
That box is a ComboBox. You should just be able to select it from the DropDown list. No typing required. If it is not one of the selection then the displayed field is probably not a date field.
 
That was it! The combo box was set as a text field. As soon as I changed it in design mode to 'date', everything worked fine.

Thanks ruralguy!
 
Slight problem now i'm afraid!

Unless I alter the long date format on people's computers who are exporting the form, it does not display the day of the week, just the date (I had to alter my settings).

Is there anyway that I can use ShortDate, and then calculate afterwards what day of the week it is?

Thanks
 
That should not matter. You should be able to set the format for that field [combo box] to DDDD to display the DAY of the week for the displayed date value.

You can also do it in the SQL of your combo box for that field.

=Format([DateFieldName],"dddd")
 

Users who are viewing this thread

Back
Top Bottom