M
mrs
I get "You cacelled the previous operation." error when I
try to run a query.
I have a form with two drop down boxes, a begin and a end
date and a button that runs a query. The query looks at
the form to determine what to display.
Here is the SQL for the query:
SELECT tblEvents.StartDate, tblEvents.ProductID,
tblEvents.SubCategorieID, tblEvents.AssignedToID,
tblEvents.EmployeeID, tblEvents.CompletedByDate,
tblEvents.CompletedByID, tblEvents.Discrepancy,
tblEvents.Resolution, tblEvents.VerifiedByID,
tblEvents.VerifiedByDate, tblEvents.PriorityID,
tblEvents.ProblemTypeID, tblEvents.VersionID,
tblEvents.EventID, tblEvents.Subject
FROM tblEvents
WHERE (((tblEvents.StartDate) Between DatePart("m",
[forms]![frmStrtDtStrBy]![dtstartDate4]) & "/" & DatePart
("d",[forms]![frmStrtDtStrBy]![dtstartDate4]) & "/" &
DatePart("yyyy",[forms]![frmStrtDtStrBy]![dtstartDate4])
And DatePart("m",[forms]![frmStrtDtStrBy]!
[dtstartDate4_2]) & "/" & DatePart("d",[forms]!
[frmStrtDtStrBy]![dtstartDate4_2]) & "/" & DatePart
("yyyy",[forms]![frmStrtDtStrBy]![dtstartDate4_2])) AND
((tblEvents.ProductID)=[forms]![frmStrtDtStrBy]!
[cmbProductName4]) AND ((tblEvents.SubCategorieID)=
[forms]![frmStrtDtStrBy]![comboSubCat4]))
ORDER BY tblEvents.StartDate, tblEvents.AssignedToID;
FYI: I have used the "Between DatePart" of the WHERE
clause in other queries and they work.
And here is the VB script for the button:
Private Sub Command88_Click()
On Error GoTo Err_Command88_Click
Dim stDocName As String
stDocName = "fqryProSubCatDate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command88_Click:
Exit Sub
Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click
End Sub
Any ideas?
Thanks,
Matt
try to run a query.
I have a form with two drop down boxes, a begin and a end
date and a button that runs a query. The query looks at
the form to determine what to display.
Here is the SQL for the query:
SELECT tblEvents.StartDate, tblEvents.ProductID,
tblEvents.SubCategorieID, tblEvents.AssignedToID,
tblEvents.EmployeeID, tblEvents.CompletedByDate,
tblEvents.CompletedByID, tblEvents.Discrepancy,
tblEvents.Resolution, tblEvents.VerifiedByID,
tblEvents.VerifiedByDate, tblEvents.PriorityID,
tblEvents.ProblemTypeID, tblEvents.VersionID,
tblEvents.EventID, tblEvents.Subject
FROM tblEvents
WHERE (((tblEvents.StartDate) Between DatePart("m",
[forms]![frmStrtDtStrBy]![dtstartDate4]) & "/" & DatePart
("d",[forms]![frmStrtDtStrBy]![dtstartDate4]) & "/" &
DatePart("yyyy",[forms]![frmStrtDtStrBy]![dtstartDate4])
And DatePart("m",[forms]![frmStrtDtStrBy]!
[dtstartDate4_2]) & "/" & DatePart("d",[forms]!
[frmStrtDtStrBy]![dtstartDate4_2]) & "/" & DatePart
("yyyy",[forms]![frmStrtDtStrBy]![dtstartDate4_2])) AND
((tblEvents.ProductID)=[forms]![frmStrtDtStrBy]!
[cmbProductName4]) AND ((tblEvents.SubCategorieID)=
[forms]![frmStrtDtStrBy]![comboSubCat4]))
ORDER BY tblEvents.StartDate, tblEvents.AssignedToID;
FYI: I have used the "Between DatePart" of the WHERE
clause in other queries and they work.
And here is the VB script for the button:
Private Sub Command88_Click()
On Error GoTo Err_Command88_Click
Dim stDocName As String
stDocName = "fqryProSubCatDate"
DoCmd.OpenQuery stDocName, acNormal, acEdit
Exit_Command88_Click:
Exit Sub
Err_Command88_Click:
MsgBox Err.Description
Resume Exit_Command88_Click
End Sub
Any ideas?
Thanks,
Matt