Hello.
I have a form where the user puts in a start date and and end date and selects an employee. It runs a query and makes a table and that table is used in a report.
The issues I am having is that the user selects a start date and end date and name and it displays the information for thouse date ranges. When they leave the name blank it show all names, which is what I want it to do but it also shows all dates instead of the ranges. I have an AND critera in for the workdate and looking at the forms start and end date and an is null statement for the name.
Here's the code I'm working with.
SELECT quniDataSYS1.UserID, quniDataSYS1.SystemID, quniDataSYS1.WorkDate, quniDataSYS1.DateStamp, quniDataSYS2.TrxTypeID, quniDataSYS2.TrxTypeValue, qryUserActive.CommaName, tblTrxType.TrxType INTO tblUsageAllData
FROM ((quniDataSYS1 INNER JOIN quniDataSYS2 ON (quniDataSYS1.SystemID = quniDataSYS2.SystemID) AND (quniDataSYS1.PAutoID = quniDataSYS2.PAutoID)) INNER JOIN qryUserActive ON quniDataSYS1.UserID = qryUserActive.UserID) INNER JOIN tblTrxType ON quniDataSYS2.TrxTypeID = tblTrxType.TrxTypeID
WHERE (((quniDataSYS1.WorkDate)>=[Forms]![frmDataUsage]![cboStartDate] And (quniDataSYS1.WorkDate)<=[Forms]![frmDataUsage]![cboEndDate]) AND ((qryUserActive.CommaName)=[Forms]![frmDataUsage]![cboEmployee])) OR (((quniDataSYS1.WorkDate) Is Null) AND (([forms]![frmDataUsage]![cboEmployee]) Is Null));
Please let me know if you see anything off.
Thank you.
I have a form where the user puts in a start date and and end date and selects an employee. It runs a query and makes a table and that table is used in a report.
The issues I am having is that the user selects a start date and end date and name and it displays the information for thouse date ranges. When they leave the name blank it show all names, which is what I want it to do but it also shows all dates instead of the ranges. I have an AND critera in for the workdate and looking at the forms start and end date and an is null statement for the name.
Here's the code I'm working with.
SELECT quniDataSYS1.UserID, quniDataSYS1.SystemID, quniDataSYS1.WorkDate, quniDataSYS1.DateStamp, quniDataSYS2.TrxTypeID, quniDataSYS2.TrxTypeValue, qryUserActive.CommaName, tblTrxType.TrxType INTO tblUsageAllData
FROM ((quniDataSYS1 INNER JOIN quniDataSYS2 ON (quniDataSYS1.SystemID = quniDataSYS2.SystemID) AND (quniDataSYS1.PAutoID = quniDataSYS2.PAutoID)) INNER JOIN qryUserActive ON quniDataSYS1.UserID = qryUserActive.UserID) INNER JOIN tblTrxType ON quniDataSYS2.TrxTypeID = tblTrxType.TrxTypeID
WHERE (((quniDataSYS1.WorkDate)>=[Forms]![frmDataUsage]![cboStartDate] And (quniDataSYS1.WorkDate)<=[Forms]![frmDataUsage]![cboEndDate]) AND ((qryUserActive.CommaName)=[Forms]![frmDataUsage]![cboEmployee])) OR (((quniDataSYS1.WorkDate) Is Null) AND (([forms]![frmDataUsage]![cboEmployee]) Is Null));
Please let me know if you see anything off.
Thank you.