Find Maximum Date Except The Current System Date

a_20120

tan
Local time
Today, 16:04
Joined
Nov 21, 2006
Messages
175
Dear all,

How can I get the maximum "Greatest" Date except the Current Today Date.
mean not consider the Today System Date.

VBA:
Code:
Dim LastDate, TodayDate
TodayDate = Date 'Current Today Date
LastDate = DMAX("[Datee]","DailyAccount","[Datee] <>" & "#" & TodayDate & "#")
Me.RecentLastDate_txt.value = LastDate

Note:
[Datee] : is the Field Name
"DailyAccount" : is Table Name
RecentLastDate_txt : is TextBox Control

But not work, what I want.
 
Last edited:
your code looks like it ought to get the correct date (assuming you are interrogating the "daily account" table correctly).

what error are you getting with your code?
 
I have no Error in the code, but I like to find the MAX date in the table, not consider and look the Current System Date, mean if the max is the Current System Date not count that, mean ignore the Current System Date.
 
What do you exactly want ???
Do you want to coun something (in query),
or you want to get the record (with max date) on the form,
or something other.
 
Want to find Max Date of Table

MStef said:
What do you exactly want ???
Do you want to coun something (in query),
or you want to get the record (with max date) on the form,
or something other.

I want to find Greatest "Max" Date in the Table except the Current Date (Current System Date).
 
Look at "DemoMaxDateA2000.mdb" (attachment).
When you open Form1, the first record is a record
with MAX DATE (08/12/2006) except th current Date.
Look at Record Source properties.
 

Attachments

i mean, your code looks like it should work correctly.

your posting/question implies that it isn't. so how do you know you are not getting the correct result?
 
MStef

MStef said:
Look at "DemoMaxDateA2000.mdb" (attachment).
When you open Form1, the first record is a record
with MAX DATE (08/12/2006) except th current Date.
Look at Record Source properties.

See The Attachment
 

Attachments

Here it is.
Look at Query1 (SQL), look at VBA.
 

Attachments

Users who are viewing this thread

Back
Top Bottom