Select Case
Basically I have three buttons which is liked to a calendar and these three buttons are linked to the textboxes...All i have to do is that enter this code... the code does work but there is a compile error saying SELECT CASE WITHOUT CASE
this is my code:
Private Sub cmdSet_Click()
'Set date in source object
Select Case GCalSource
Case "date_on_call_1"
Form_frmStaffDetails.date_on_call_1 = CalObject.Value
If ((CalObject.Value = Form_frmStaffDetails.date_on_call_2) Or (CalObject.Value = Form_frmStaffDetails.date_on_call_3)) Then
MsgBox ("Invalid Date! Doctor cannot be on call at same times.")
Else
If (CalObject.Value < date) Then
MsgBox ("Invalid Date! The doctor cannot be on call on a previous date.")
Else
DoCmd.Close acForm, "FrmCalendar2"
End If
Case "date_on_call_2"
Form_frmStaffDetails.date_on_call_2 = CalObject.Value
If ((CalObject.Value = Form_frmStaffDetails.date_on_call_1) Or (CalObject.Value = Form_frmStaffDetails.date_on_call_3)) Then
MsgBox ("Invalid Date! Doctor cannot be on call at same times.")
Else
If (CalObject.Value < date) Then
MsgBox ("Invalid Date! The doctor cannot be on call on a previous date.")
Else
DoCmd.Close acForm, "FrmCalendar2"
End If
Case "date_on_call_3"
Form_frmStaffDetails.date_on_call_3 = CalObject.Value
If ((CalObject.Value = Form_frmStaffDetails.date_on_call_1) Or (CalObject.Value = Form_frmStaffDetails.date_on_call_2)) Then
MsgBox ("Invalid Date! Doctor cannot be on call at same times.")
Else
If (CalObject.Value < date) Then
MsgBox ("Invalid Date! The doctor cannot be on call on a previous date.")
Else
DoCmd.Close acForm, "FrmCalendar2"
End If
Case Else
DoCmd.Close acForm, "frmCalendar2"
End Select
End Sub
But when i run this code it comes up with an error saying Select case Without Case.... What does that mean and what do i have to?
Can anyone tell me?
Thanx
Junaid
|