a_20120
12-11-2006, 02:00 AM
Dear all,
How can I get the maximum "Greatest" Date except the Current Today Date.
mean not consider the Today System Date.
VBA:
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.
MStef
12-11-2006, 02:05 AM
Try it with DateAdd function.
gemma-the-husky
12-11-2006, 02:11 AM
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?
a_20120
12-11-2006, 02:22 AM
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.
a_20120
12-11-2006, 02:23 AM
How can I do that, Plz write me the Code.
MStef
12-11-2006, 02:35 AM
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.
a_20120
12-11-2006, 02:52 AM
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).
MStef
12-11-2006, 03:05 AM
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.
gemma-the-husky
12-11-2006, 03:09 AM
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?
a_20120
12-12-2006, 12:58 AM
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
MStef
12-12-2006, 01:43 AM
Here it is.
Look at Query1 (SQL), look at VBA.