Dynamic Criteria

Littlemalky

Board Regular
Joined
Jan 14, 2011
Messages
223
I need to know how to make a criteria dynamic to read a field in another table so that whenever the data in that field changes the criteria can adjust to it. The data in that field is a date, if that's relevant. Is this possible?
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Is it a one-record table? If so, just add it to your query. You won't even need to do a join if it has just one record. Then it is available for you to use.
 
Upvote 0
Can you post your code and explain exactly what you are trying to do?
Maybe post some data samples?
 
Upvote 0
Suppose the field in the otherTable that contains the Date is CriteriaDate,
and the table you are dealing with is CurrentTable and the field to be compared is MyDate.
Then a query along these lines should work. I'm using =, but it could be < or > etc.

Select
CurrentTable.field1,
CurrentTable,field2,
CurrentTable.fieldx
from CurrentTable, otherTable
WHERE
CurrentTable.MyDate = otherTable.CriteriaDate
 
Upvote 0
Access Criteria Issue

I have a similar problem and tried to use your example jack but it’s not working for me. I’m new to SQL but know VBA well so bare with me as I learn. I am uploading a spreadsheet into a table, then I’m trying to run a delete query in another table that holds the history of this spreadsheet, I want to make the delete query's criteria to be the avg of one of the fields from the first table that happens to be a date. After that is done I will be appending the new table over to the history table. How do I call the field from the first table as the criteria for the query on the second table?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>
 
Upvote 0
I have a similar problem and tried to use your example jack but it’s not working for me. I’m new to SQL but know VBA well so bare with me as I learn. I am uploading a spreadsheet into a table, then I’m trying to run a delete query in another table that holds the history of this spreadsheet, I want to make the delete query's criteria to be the avg of one of the fields from the first table that happens to be a date. After that is done I will be appending the new table over to the history table. How do I call the field from the first table as the criteria for the query on the second table?<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>

Can you show your tables and what you want to achieve? I'm confused with the Avg of one of the fields that happens to be a Date ?
 
Upvote 0
Re: Access Criteria Issue

So as not to hijack the original poster's question, I have split your question from this from the original thread and made it its own thread.
 
Last edited:
Upvote 0
Re: Access Criteria Issue

Actually Malky and I work together so it was supposed to be under the same issue.
 
Upvote 0
Actually Malky and I work together so it was supposed to be under the same issue.
OK, I moved it back.

Jack and I both requested more information so we can get a better picture of what you trying to do. We are awaiting on responses to those requests so we can help you (details, please!).
 
Upvote 0

Forum statistics

Threads
1,224,608
Messages
6,179,872
Members
452,949
Latest member
Dupuhini

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