Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
  1. #16
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60
    i would use something like this

    dim MyDate as date



    MyDate = DMax("DateEnter","Trans", here i want the criteria not in Dmax("DateEnter","Trans","") as orange did in SQL
    how can i get that?

  2. #17
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,870
    I reread your post
    i cant use SQL, since i need it should return a value, and then set it to variable, so thats why i asked for a vba idea
    I have attached some vba that uses my table Ancestor (see top of attached jpg for existing records)
    The sub is called SecondLast.
    The result in variable "YourVariable" is shown in the immediate window.Click image for larger version. 

Name:	SecondLastDate_vbaWithVariable.jpg 
Views:	10 
Size:	133.5 KB 
ID:	14605

  3. #18
    Auto is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2013
    Posts
    60
    thank you very much all of you, i was missing the rs! that's why it didn't worked.
    again thank you orange for your kind help, and itsme for your advice, its now working.

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 07-09-2013, 06:31 PM
  2. Replies: 1
    Last Post: 02-12-2013, 03:48 AM
  3. Replies: 5
    Last Post: 12-18-2012, 02:37 PM
  4. Replies: 3
    Last Post: 08-21-2012, 03:05 PM
  5. Replies: 15
    Last Post: 04-06-2012, 10:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums