Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Syntax error (Access 2000)

    I want to make a table only with the last record and i use DMax but i cant do it properly.I get a syntax error. Could you help ?

    Dim strOrders As String
    strOrders = " SELECT orders.* INTO orders1 FROM orders WHERE orders.Suborder = -1 and orders.orderid = Dmax'"
    CurrentDb.Execute strOrders

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Syntax error (Access 2000)

    Try this


    Dim strOrders As String
    Dim lngMaxOrderID as long
    lngMaxOrderID = Dmax("[OrderID]","Orders")

    strOrders = " SELECT orders.* INTO orders1 FROM orders WHERE orders.Suborder = -1 and orders.orderid = " & lngMaxOrderID
    CurrentDb.Execute strOrders
    Regards
    John



  3. #3
    4 Star Lounger
    Join Date
    Feb 2002
    Posts
    537
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Syntax error (Access 2000)

    Yes, it works ! thank you very much !

Posting Permissions

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