473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 22953
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 : SELECT Sum(.liters) AS SumOfLiters, orders.invoicedate...
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 invoicedate.This invoice date is in the table orders....
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: ------------------------------------------------- dim dateCCJApprovedDate as DateTime if...
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 format? Example, User Defined Date Format as...
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 or REPLACE FUNCTION week_start(integer, integer)...
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 provides a list of times, (10:00, 11:00 etc), and I...
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 all my clients then show any client that the...
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 used to enter donations has 4 entry...
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 - A table with the Revision history of the Drawings...
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. but not getting date value. Any can help me why...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.