Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
I have a form with a calendar-control on it.
The source of this calendar is the field "DATE", which is in the table "LOGS".
The default value of field DATE in table LOGS is Date(), so when I add a new record on my form (by clicking on the right arrow), the calendar always shows the date of today...
I want to change that. I want the calendar to show the latest date entered in the table (dmax?)
I tried dmax in the default value of the field "DATE", but that doesn't work.
I tried with vba code, to update the calendar, but this generates errors...
Can someone help please?
Thanks
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
is this in access, excel or some other application?
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
Quote:
Originally Posted by
westconn1
is this in access, excel or some other application?
Sorry, it's in access
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
Code:
Sub MinMaxX()
Dim dbs As Database, rst As Recordset
' Modify this line to include the path to Northwind
' on your computer.
Set dbs = OpenDatabase("Northwind.mdb")
' Return the lowest and highest freight charges for
' orders shipped to the United Kingdom.
Set rst = dbs.OpenRecordset("SELECT " _
& "Min(Freight) AS [Low Freight], " _
& "Max(Freight)AS [High Freight] " _
& "FROM Orders WHERE ShipCountry = 'UK';")
' Populate the Recordset.
rst.MoveLast
' Call EnumFields to print the contents of the
' Recordset. Pass the Recordset object and desired
' field width.
EnumFields rst, 12
dbs.Close
End Sub
straight out of the manual...
this shows how to get min and max from the data, it will be the only way to do i think.
here to help (i can generate a bit of code if you want but there is no point it all depends on your data definitions)