Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    too few parameters (Access 2000)

    Can you help me ? I am having troubles with creating the second table order detailsTemp where i get the error Too few parmeters. My original tables are orders1 and order details1 and i want to make the tables ordersTemp nd order detalstemp.i suceed iny with ordersTemp:

    Dim strsql As String
    Dim lngMaxOrderID As Long
    lngMaxOrderID = DMax("[OrderID]", "orders1")
    Dim StrOrders As String
    Dim strOrderDetails As String


    StrOrders = " SELECT orders1.* INTO ordersTemp FROM orders1 WHERE orders1.Suborder = -1 and orders1.orderid = " & lngMaxOrderID
    CurrentDb.Execute StrOrders
    CurrentDb.Execute "CREATE INDEX PrimaryKey ON OrdersTemp (OrderID) WITH PRIMARY"

    strOrderDetails = " SELECT[order details1].orderid,[order details1].productid,[order details1].cartons,[order details1].quantity " & _
    " INTO [Order DetailsTemp] FROM [order details1] INNER JOIN orders ON [order details1].OrderID = [orders].orderid WHERE orders1.Suborder = -1"
    CurrentDb.Execute strOrderDetails

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: too few parameters (Access 2000)

    1) You declare a variable strSQL but don't use it.

    2) You retrieve the maximum value of OrderID, then insert records into OrdersTemp for which OrderID is equal to this maximum value and Suborder is True. But perhaps the record with the maximum OrderID doesn't have Suborder = True...

    3) Your second SQL string joins Order Details1 to Orders, not to Orders1, but then refers to Orders1.Suborder.

    4) The value lngMaxOrderID isn't used in the second SQL string, so you'll fill Order DetailsTemp with records for many other OrderIDs.

  3. #3
    2 Star Lounger
    Join Date
    Mar 2006
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: too few parameters (Access 2000)

    Thank you hANS, i am very grateful for your valued answers.These are exactly the reasons for my faults

Posting Permissions

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