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

    update query too few parameters (Access 2000)

    Update query too few parmeters


    My function called UpdateOrders is triggered by the OnClick event
    of a List box called ListOrderID. This list box shows the orders with their orderid number.
    I produce however the error too few parameters,which means that
    i am not referring correctly somewhere.
    Could i have some help?
    Below is the function:

    Public Function UpdateOrders()
    Dim MyForm As Form
    Set MyForm = Forms![frmCustomerOrders]

    Dim strWhere As String, strCondition As String
    strCondition = "OrderID=" & MyForm.ListOrderID
    strWhere = " WHERE " & strCondition




    strSQL = "UPDATE orders INNER JOIN (products INNER JOIN " & " [order details] ON (products.Productid = [order details].ProductID) " & "AND

    (products.Productid = [order details].ProductID)) " & "ON orders.orderid = [order details].OrderID" & _
    " SET " & "products.Line1 = products.branchLine1 +[order details].cartons & StrWhere"

    CurrentDb.Execute strSQL
    End Function

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: update query too few parameters (Access 2000)

    Your statement:

    strSQL = "UPDATE orders INNER JOIN (products INNER JOIN " & " [order details] ON (products.Productid = [order details].ProductID) " & "AND

    (products.Productid = [order details].ProductID)) " & "ON orders.orderid = [order details].OrderID" & _
    " SET " & "products.Line1 = products.branchLine1 +[order details].cartons & StrWhere"

    should probably read as follows:

    strSQL = "UPDATE orders INNER JOIN (products INNER JOIN " & " [order details] ON (products.Productid = [order details].ProductID) " & "AND

    (products.Productid = [order details].ProductID)) " & "ON orders.orderid = [order details].OrderID" & _
    " SET " & "products.Line1 = products.branchLine1 +[order details].cartons" & StrWhere

    Notice that I moved the trailing quotes after strWhere to after [order details].cartons
    HTH
    Pat <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

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

    Re: update query too few parameters (Access 2000)

    When you get problems like this with constructed sql expressions giving errors, you can help yourself debug them by putting msgbox(sql) immediately before the Curentdb.Execute line.

    If you have " marks in the wrong place, you will often see references to forms in the sql rather than the value of those items.
    Regards
    John



Posting Permissions

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