Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I want to assign the highest (=max) value of field LastDraw in table DrawDetail to a variable.
    I have written a query which returns this value, and I was going to copy the SQL to use in a VB routine, but now I seem to remember that it's only permissable to run SQL for action queries - like Delete, Update etc. Correct?
    I would run the query, but whenever I've tried to execute a query from VB in the past, it runs in datasheet mode which clearly I don't want.
    What do I need to do in order to assign this value to a VB variable, please?
    Thanks
    Silverback

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts
    [quote name='silverback' post='769250' date='05-Apr-2009 14:43'][/quote]
    You don't need a query or Sql to do this. Just use the DMax function.
    MyVariable = DMax("LastDraw", "DrawDetail")
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi, Francois
    Just the ticket.
    All working, now.
    Thanks
    Silverback

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •