Results 1 to 2 of 2
  1. #1
    2 Star Lounger
    Join Date
    Nov 2001
    Thanked 0 Times in 0 Posts

    make table with criteria (Access 2000)

    When i issue an order in my database, sonmetimes i want to make a table only for a given order.My autonumber field in the table [orders] is
    called orderID.To this end i tried to add the line :
    On [orders].orderid = [orders].orderid;

    Or in the whole code:
    Dim StrOrders as String
    StrOrders = "SELECT orders.orderid, orders.customerid, orders.orderdate, orders.[required date] INTO Temp
    FROM orders On [orders].orderid = [orders].orderid;
    CurrentDb.Execute StrOrders

    But then i receive "Syntax error in FROM Clause

    Perhaps i should refer to the control in the Form? The name of my control is called CmdMakeTable
    May i have some help ?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: make table with criteria (Access 2000)

    ON is used to join tables or queries, not to impose a condition. Besides, [orders].orderid = [orders].orderid isn't going to do much.

    What you want is a WHERE clause and a reference to the value of orderid on the form (not to cmdMakeTable, assuming that that is a command button). The reference should be put outside of the quotes.


    StrOrders = "SELECT orderid, customerid, orderdate, [required date] INTO Temp " & _
    "FROM orders WHERE orderid = " & Me.orderid

    If the text box containing orderid on the form is named txtOrderId, replace

Posting Permissions

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