Hi
Can somebody help me,
I am trying combine following two fields in ms access vba,
Private Sub Command6_Click()
DoCmd.OpenForm "frmRecordbetweenTwoDatesbyDoctorNameFormView", , , "dtDate between #" & Format([ApptStartDate], "dd-mmm-yyyy") & "# And #" & Format([ApptEndDate], "dd-mmm-yyyy") & "# And [txtConsultantDoctorName] = '" & Me.CBODocName & "'"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.Close acForm, "frmSearchAppointmentsBetween2DatesBYDOCNAME", acSaveYes
End Sub
----------
I am actually trying to pass parameters from a form which contains start and end date and a combo box containing names. what actually I am trying is looking up doctors' appointments between two dates with their names (doctor name). I am able to search them separately.
I am new to vba
I get following error:
Run-Time error '2501':
The OpenFormaction was canceled.
and if I implement following
DoCmd.OpenForm "frmRecordbetweenTwoDatesbyDoctorNameFormView", , , "dtDate between #" & Format([ApptStartDate], "dd-mmm-yyyy") & "# And #" & Format([ApptEndDate], "dd-mmm-yyyy") & "# " And " &[txtConsultantDoctorName] = '" & Me!CBODocName & "'"
code error becomes:
Run-Time error '13'
type mismatch