472,353 Members | 1,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

How to use DLookup to get last date value.

reginaldmerritt
201 100+
I'm trying to see if I can use DLookup instead of a Recordset to find a specific record.

To find this record I think I only need one criteria. The problem is that this record must be the record with the oldest date amongst all the records with this criteria.

Expand|Select|Wrap|Line Numbers
  1. DLookup("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID)
  2.  
The expression part of the Dlookup code "Bottom 1 EndDate" obviously needs tweaking or is that even possible?

I guess I could create a RecordSet and then loop though the RecordSet picking out records where the "[ProjectID] = " & Me.ProjectID and then storing the EndDate into an array; which I could then use to compare each array entry to each other. But this seems like the Long Way Round to me.

Is this the best way of going about this or is there a better way?

Any Ideas Welcome, Thanks.
Aug 21 '10 #1

✓ answered by liimra

Just Use:
DMin("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID)
to get the Oldest Date


And

DMax(("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID)
to get the Newest Date.

Regards,
Ali

4 22383
liimra
119 100+
Just Use:
DMin("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID)
to get the Oldest Date


And

DMax(("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID)
to get the Newest Date.

Regards,
Ali
Aug 22 '10 #2
liimra
119 100+
Forgot to add,

Use:
Expand|Select|Wrap|Line Numbers
  1. DLast("Bottom 1 EndDate", "TBTasks", "[ProjectID] = " & Me.ProjectID) 
to get the last entered date irrespective of its position among others

Please note that it is recommended not to use space for names. Field Name: "Bottom 1 EndDate" --> "Bottom1EndDate"

Regards,
Ali
Aug 22 '10 #3
reginaldmerritt
201 100+
Thanks Ali. I knew there had to be a method I could use. Works perfectly thanks.

BTW The field is named 'EndDate' , was trying to use 'Bottom 1' as you would with 'Top 1' in an SQL statement.

Many Thanks
Aug 22 '10 #4
liimra
119 100+
Glad it worked,

Regards,
Ali
Aug 22 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: samotek | last post by:
Filter the last date only I am trying t0 filter only the last date of the query,but i cannot manage that. My query is the following : ...
2
by: solar | last post by:
I have a problem with building a totals query showing data for the last date only.Under the last date i understand the last date of field...
5
by: darrel | last post by:
I have the following right now to enter a date into SQL getting the data from some pull down menus: ...
1
by: abcabcabc | last post by:
I write an application which can let user define own date format to input, How to convert the date string to date value with end-user defined date...
0
by: Lee Harr | last post by:
I wrote a function to return the first date of a given week (and a few related functions) : -- return the first date in the given week CREATE...
6
by: Aussie Rules | last post by:
Hi, I have a datepicker that show a calender. The user picks a date and the time component is always 00:00. I then have a drop down that...
9
by: ice | last post by:
Hello, I have a couple of tables. The client tables and the contacted tables. I am not sure how to start on this, what I need is a way to query ...
6
lobstah24
by: lobstah24 | last post by:
OK...I'm new to MS Access but I am progressing pretty well. I've made a small and simple D Base for our church to track member donations. The form...
2
oszapped
by: oszapped | last post by:
I am new to creating SQL queries and need some help. I am trying to query from three tables. 1 - A table with a list of Drawings (DRAWINGS) 2 -...
9
vikas251074
by: vikas251074 | last post by:
I am not getting date value in spite of my good effort. This code was working in my last office where I work. Now I am trying to work at my home pc....
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.