ASKER
Private Sub YouCombo_BeforeUpdate(Cancel As Integer)
if yourcombo= me.doctorid then
Cancel=true
else
end if
End Sub
As for the point you can ask for help from mods
ASKER
Private Sub Doctor_BeforeUpdate(Cancel As Integer)
If Doctor = Me.DoctorName Then
Cancel = True
Else
End If
End Sub
if Doctor.Column(1) = Me.DoctorName Then
ASKER
ASKER
If Doctor.Column(1) = Me.DoctorName Then
MsgBox "The doctor you have chosen already has a scheduled event in this time slot."
Me.Doctor = ""
Cancel = True
Else
End If
If Doctor.Column(1) = Me.DoctorName Then
MsgBox "The doctor you have chosen already has a scheduled event in this time slot."
Cancel = True
Me.Doctor.Undo
Else
End If
ASKER
Private Sub Form_BeforeUpdate(Cancel As Integer)
Dim strWHERE As String
If Me.txtAppointmentDate & "" = "" Then
MsgBox "Appointment Date is required.", vbOKOnly
Cancel = True
Me.txtAppointmentDate.SetFocus
Exit Sub
End If
If Me.txtAppointmentTime & "" = "" Then
MsgBox "Appointment Time is required.", vbOKOnly
Cancel = True
Me.txtAppointmentTime.SetFocus
Exit Sub
End If
If Me.cboDoctorName & "" = "" Then
MsgBox "Doctor Name is required.", vbOKOnly
Cancel = True
Me.cboDoctorName.SetFocus
Exit Sub
End If
strWHERE = "AppointmentDate = #" & Me.txtAppointmentDate & "# AND AppointmentTime = #" & Me.txtAppointmentTime & "#" And DoctorName = " & Me.cboDoctorName"
If DCount("*", "tblPotenialAppointmentDate", strWHERE) > 0 Then
MsgBox "This doctor is already booked for this time slot. Please choose a different doctor or a different time/date.", vbOKOnly
Cancel = True
Me.cboDoctorName.SetFocus
Exit Sub
End If
End Sub
ASKER
Dim strWHERE As String
If Me.Date & "" = "" Then
MsgBox "Appointment Date is required.", vbOKOnly
Cancel = True
Me.Date.SetFocus
Exit Sub
End If
If Me.Time & "" = "" Then
MsgBox "Appointment Time is required.", vbOKOnly
Cancel = True
Me.Time.SetFocus
Exit Sub
End If
If Me.Doctor & "" = "" Then
MsgBox "Doctor Name is required.", vbOKOnly
Cancel = True
Me.Doctor.SetFocus
Exit Sub
End If
strWHERE = "AppointmentDate = #" & Forms!frmScheduleHeader.Form.Date & "# AND Forms!frmScheduleHeader.Form.Time = #" & Forms!frmScheduleHeader.Form.Time & "#" And DoctorName = " & Me.cboDoctorName"
If DCount("*", "tblPotenialAppointmentDate", strWHERE) > 0 Then
MsgBox "This doctor is already booked for this time slot. Please choose a different doctor or a different time/date.", vbOKOnly
Cancel = True
Forms!frmScheduleHeader.Form.DoctorName.SetFocus
Exit Sub
End If
If len(Me.Date) =0 Then
similar for the others
ASKER
Microsoft Access is a rapid application development (RAD) relational database tool. Access can be used for both desktop and web-based applications, and uses VBA (Visual Basic for Applications) as its coding language.
TRUSTED BY