[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Access 2010 - How to set a constant to a query result

Posted on 2013-06-26
3
Medium Priority
?
738 Views
Last Modified: 2013-06-26
Hi Experts,

I have a database with a table (t_datadate).  I have a query q_DataDate_MAX which uses Max to find the most recent date.  I often have to join this query to a date field in other queries to filter for one date, however, I was hoping I could just use something that acts like a global constant under Criteria in the query grid instead.  Since the max date often changes, I know I can't define a constant as a specific date (I've found VBA examples on this), but wondering how I could have the constant equal to the result of the Max date query?  Maybe I'm using the wrong concept to try and accomplish this, so please forgive my ignorance : )
0
Comment
Question by:grmcra
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 61

Accepted Solution

by:
mbizup earned 2000 total points
ID: 39278693
You can use DMAx:

Constant = dmax("yourdatefield" , "yourtable")
0
 
LVL 61

Assisted Solution

by:mbizup
mbizup earned 2000 total points
ID: 39278722
An alternative is to use DLookup to pull the MaxDate from your existing query:

x = DLookup("YourFieldName", "q_DataDate_MAX")


See Jim Dettman's article about DLookup and the Domain functions for a thorough explanation of this topic:
http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_12-Dlookup-and-the-Domain-Functions.html
0
 

Author Closing Comment

by:grmcra
ID: 39278860
Works great and thanks for the resource link!
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Access custom database properties are useful for storing miscellaneous bits of information in a format that persists through database closing and reopening.  This article shows how to create and use them.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

650 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question