Results 1 to 5 of 5

Thread: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    62

    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

  2. #2

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    62

    Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...

    nobody please?

  3. #3
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    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

  4. #4

    Thread Starter
    Member
    Join Date
    Jun 2010
    Posts
    62

    Re: Off97: Calendar (MSCAL.Calendar.7) needs to show the highest saved date...

    Quote Originally Posted by westconn1 View Post
    is this in access, excel or some other application?
    Sorry, it's in access

  5. #5
    Frenzied Member
    Join Date
    Nov 2010
    Posts
    1,470

    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
  •  



Click Here to Expand Forum to Full Width