Results 1 to 3 of 3

SQL max ID return!

Threaded View

  1. #1
    Registered User
    Join Date
    09-23-2010
    Location
    London, England
    MS-Off Ver
    2007
    Posts
    97

    SQL max ID return!

    hi i need to be able to find the value of the maximum ID in a table i have using VBA. played around with a few variations but none of them seem to wok. Generally they return Syntax errors though i have tried a number of suggestions from a buch of sources.

    rst.Open "Select MAX(ID) FROM Package", conn, adOpenDynamic, adLockOptimistic, adCmdTable
      
                Sheets("New Package").Range("B13").CopyFromRecordset rst
                      
                maxi = Range("B13").Value + 1
                
                rst.Close
                
                rst.Open "package", conn, adOpenDynamic, adLockOptimistic, adCmdTable

    Thanks!
    Last edited by Jollyfrog; 10-06-2010 at 12:15 PM. Reason: correct tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1