If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Visual Basic > Please help

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 01-18-12, 14:42
18Dude88 18Dude88 is offline
Registered User
 
Join Date: Nov 2011
Posts: 9
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
Reply With Quote
  #2 (permalink)  
Old 01-30-12, 08:31
MikeTheBike MikeTheBike is offline
Registered User
 
Join Date: Apr 2004
Location: Derbyshire, UK
Posts: 714
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
Reply With Quote
  #3 (permalink)  
Old 01-30-12, 11:38
Teddy Teddy is offline
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,075
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? ***
Reply With Quote
Reply

Tags
insert error

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On