|
-
Feb 13th, 2012, 05:04 AM
#1
Thread Starter
Member
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
-
Feb 14th, 2012, 03:42 AM
#2
Thread Starter
Member
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
-
Feb 14th, 2012, 07:00 AM
#3
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
is this in access, excel or some other application?
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
-
Feb 14th, 2012, 07:05 AM
#4
Thread Starter
Member
Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...
 Originally Posted by westconn1
is this in access, excel or some other application?
Sorry, it's in access
-
Feb 14th, 2012, 02:16 PM
#5
Frenzied Member
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)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|