Results 1 to 3 of 3

Thread: Please help

  1. #1
    Join Date
    Nov 2011
    Posts
    9

    Unanswered: Please help

    str4SQL = "SELECT Yes AS Upload, WOs_MOs.[WO#], WOs_MOs.PRCMPY, WOs_MOs.[PRORD#],WOs_MOs.O1LINE, WOs_MOs.[O1PO#1], WOs_MOs.Promise, WOs_MOs.O1YNID, WOs_MOs.O1TYPE, WOs_MOs.O1YCLR, WOs_MOs.O1OQTY ,WOs_MOs.O1AQTY, WOs_MOs.Ship " & _
    "FROM WOs_MOs WHERE WOs_MOs.[WO#] = " & WO2 & " AND WOs_MOs.PRCMPY = '" & PRCMPY & "' AND WOs_MOs.[PRORD#] = " & PRORD & " "

    'Opens the data read only as we dont need to change it
    Set rst4 = CurrentDb.OpenRecordset(str4SQL, dbOpenSnapshot)

    Let UploadVar = rst4![Upload]
    Let WOVar = rst4![WO#]
    Let PRCMPYVar = rst4![PRCMPY]
    Let PRORDVar = rst4![PRORD#]
    Let O1LINEVar = rst4![O1LINE]
    Let O1POVar = rst4![O1PO#1]
    Let PromiseVar = rst4![Promise]
    Let O1YNIDVar = rst4![O1YNID]
    Let O1TYPEVar = rst4![O1TYPE]
    Let O1YCLRVar = rst4![O1YCLR]
    Let O1OQTYVar = rst4![O1OQTY]
    Let O1AQTYVar = rst4![O1AQTY]
    Let ShipVar = rst4![ship]

    DoCmd****nSQL = "INSERT INTO Promise_Date_Changes(Upload, WO#, PRCMPY, PRORD#, O1LINE, O1PO#1, Promise, O1YNID, O1TYPE, O1YCLR, O1OQTY, O1AQTY, ship, Promise_date_within_48, Record_Number) VALUES (" & _
    UploadVar & ", " & _
    WOVar & ", '" & _
    PRCMPYVar & "', " & _
    PRORDVar & ", " & _
    O1LINEVar & " , '" & _
    O1POVar & " ', '" & _
    PromiseDateCheck & " ', ' " & _
    O1YNIDVar & " ', '" & _
    O1TYPEVar & " ', '" & _
    O1YCLRVar & " ', " & _
    O1OQTYVar & " , " & _
    O1AQTYVar & " , '" & _
    ShipDateCheck & " ', '" & _
    PromiseDateWitVar & "', " & _
    RNumber & ")"
    Getting an argument not optional on the ****nsql

  2. #2
    Join Date
    Apr 2004
    Location
    Derbyshire, UK
    Posts
    789
    Provided Answers: 1
    Hi

    Try this

    Code:
    DoCmd****nSQL "INSERT INTO Promise_Date_Changes ... etc.
    I think you need to remover the '=' sign

    BTW ****nSQL is a bug and is typed as RunSQL with a period in from ot it, but for some reson is replaced by what you see!!??

    MTB

  3. #3
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    The ru TLD is no bueno. Sledgehammer fix.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Tags for this Thread

Posting Permissions

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