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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INSERT INTO statement syntax

Status
Not open for further replies.

handlebarry

Technical User
Dec 21, 2004
118
GB
Hi, the below statment seems to works but could someone please check the syntax - thanks

DoCmd.RunSQL "INSERT INTO tblContractsToProperties (GIS_Property_code, Property_Address, ContractCode) SELECT tblProperties.GIS_Property_Code, tblProperties.Property_Address, tblContracts.ContractCode FROM tblproperties, tblContracts WHERE tblproperties.check = True AND tblContracts.ContractCode = [Forms]![frmContractDetails]![ContractCode]"
 

DoCmd.RunSQL "INSERT INTO tblContractsToProperties (GIS_Property_code, Property_Address, ContractCode) SELECT tblProperties.GIS_Property_Code, tblProperties.Property_Address, tblContracts.ContractCode FROM tblproperties, tblContracts WHERE tblproperties.check = True AND tblContracts.ContractCode = " & Forms!frmContractDetails!ContractCode.Text

or

CurrentProject.Connection.Execute "INSERT INTO tblContractsToProperties (GIS_Property_code, Property_Address, ContractCode) SELECT tblProperties.GIS_Property_Code, tblProperties.Property_Address, tblContracts.ContractCode FROM tblproperties, tblContracts WHERE tblproperties.check = True AND tblContracts.ContractCode = " & Forms!frmContractDetails!ContractCode.Text ,adcmdText, adExecuteNoRecords

 

Always bulk transactions with no returning records for action queries is faster, so it 's the 2nd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top