Parameter Database Queries

chead5

Active Member
Joined
Jun 7, 2004
Messages
356
I have a parameter query that uses cell values to feed the query.

It basicly looks at <b>Reviewer_ID, CSR_ID, and Review_Date</b> and it works fine with just one reviewer.

What I need is the for the parameter for <b>Reviewer_ID</b> to accept up to four cells' values.

<ul>If all of the cells are empty I need the query to return all of the results for the given agent and date.
If there are any cells with data I need it to just return data based on the values in the cells</ul>
A simple <b>Or</b> operator won't work because if the reviewer cells are all empty I get no results.

Here is the current Where statement with the Or operator:
<code>WHERE (tblMasterLP.Reviewer_ID=?) AND (tblMasterLP.CSR_ID=?) AND (tblMasterLP.Review_Date Between ? And ?) OR (tblMasterLP.Reviewer_ID=?) AND (tblMasterLP.CSR_ID=?) AND (tblMasterLP.Review_Date Between ? And ?) OR (tblMasterLP.Reviewer_ID=?) AND (tblMasterLP.CSR_ID=?) AND (tblMasterLP.Review_Date Between ? And ?) OR (tblMasterLP.Reviewer_ID=?) AND (tblMasterLP.CSR_ID=?) AND (tblMasterLP.Review_Date Between ? And ?)</code>

Any Ideas on modifying this?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
You need to check the values with the number of records returned and re-modify your query based on that.
 
Upvote 0

Forum statistics

Threads
1,203,455
Messages
6,055,540
Members
444,794
Latest member
HSAL

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top