Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DoCmd.RunSQL Append Query

Status
Not open for further replies.

stevo1961

Technical User
Nov 12, 2014
18
0
0
IE
Hi,

I have an Append query named "Append Manifest" which I call using the DoCmd.OpenQuery "AppendManifest", acNormal, acEdit

INSERT INTO tblManifest ( DeliveryDocketID, DeliveryDocketNo, JobID, BatchNo, Quantity, QtyType, LabelCount, NumPallets, Status, Description )
SELECT JobsDeliveryVendor.DeliveryDocketID, JobsDeliveryVendor.DeliveryDocketNo, JobsDeliveryVendor.JobID, JobsDeliveryVendor.BatchNo, JobsDeliveryVendor.Quantity, JobsDeliveryVendor.QtyType, JobsDeliveryVendor.LabelCount, JobsDeliveryVendor.NumPallets, JobsDeliveryVendor.Status, JobsDeliveryVendor.[Material Description]
FROM JobsDeliveryVendor, tblNums
WHERE (((JobsDeliveryVendor.JobID)=[Forms]![Jobs]![JobID]) AND ((JobsDeliveryVendor.Status)>"0") AND ((tblNums.ID)<=[NumPallets]));

I am a newbie to the DoCmd.RunSQL but I would like to try and call the above using the
DoCmd.RunSQL. Could anyone point me in the direction on how to perform this?

Thanks for the help
 
Did you try:

Code:
Dim strSQL As String

strSQL = "INSERT INTO tblManifest ..."

DoCmd.RunSQL strSQL

Have fun.

---- Andy

A bus station is where a bus stops. A train station is where a train stops. On my desk, I have a work station.
 
I tried this but there is a syntax error

Dim strSQL As String

strSQL = "INSERT INTO tblManifest ( DeliveryDocketID, DeliveryDocketNo, JobID, BatchNo, Quantity, QtyType, LabelCount, NumPallets, Status, Description )
SELECT JobsDeliveryVendor.DeliveryDocketID, JobsDeliveryVendor.DeliveryDocketNo, JobsDeliveryVendor.JobID, JobsDeliveryVendor.BatchNo, JobsDeliveryVendor.Quantity, JobsDeliveryVendor.QtyType, JobsDeliveryVendor.LabelCount, JobsDeliveryVendor.NumPallets, JobsDeliveryVendor.Status, JobsDeliveryVendor.[Material Description]
FROM JobsDeliveryVendor, tblNums
WHERE (((JobsDeliveryVendor.JobID)=[Forms]![Jobs]![JobID]) AND ((JobsDeliveryVendor.Status)>"0") AND ((tblNums.ID)<=[NumPallets]))"

DoCmd.RunSQL strSQL
 
Replace this:
)>"0")
with this:
)>'0')

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top