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

Using Multiple Update Statements 1

Status
Not open for further replies.

hsp7777

Programmer
Jan 11, 2005
67
US
Greetings,
I was wondering if it was possible to issue multiple "Update" statements with a single" "db.Execute" command? I am attempting to use the SQL below, but I am receiving a syntax error. Any thoughts or suggestions?

strSQL = UPDATE [tblAudit_ApplicationLog] SET Seller = '1', Terms = 240, APR = 7.125, ProcessorLicenseNbr = '3', Appraiser = '4', AppraiserLicenseNbr = '5' WHERE LoanNumber = 'NC05-134083', UPDATE [Loan] SET ApplicationDate = #3/21/2003#, BorrowerLastName = 'Page, Jr.', PropertyAddress = '249 Smith St.', LoanAmount = 100000, LoanProgram = 'NINA', LoanRepresentative = 'Don Bartosz', Processor = 'Doug Jones', RevenueTotal = 150, Status = 'Closed', StatusDate = #6/1/2004# WHERE LoanNumber = 'NC05-134083';

db.Execute strUpdateSQL

Thanks in advance!

hsp7777
 
No, it's not. Just do them one at at time:
Code:
strSQL = "UPDATE [tblAudit_ApplicationLog] SET Seller = '1', Terms = 240, APR = 7.125, ProcessorLicenseNbr = '3', Appraiser = '4', AppraiserLicenseNbr = '5' WHERE LoanNumber = 'NC05-134083'"

db.Execute strUpdateSQL

strSQL = "UPDATE [Loan] SET ApplicationDate = #3/21/2003#, BorrowerLastName = 'Page, Jr.', PropertyAddress = '249 Smith St.', LoanAmount = 100000, LoanProgram = 'NINA', LoanRepresentative = 'Don Bartosz', Processor = 'Doug Jones', RevenueTotal = 150, Status = 'Closed', StatusDate = #6/1/2004# WHERE LoanNumber = 'NC05-134083';"

db.Execute strUpdateSQL

Also, I put double quotes around the string you're putting into strSQL. You'll need to do that for your code to work.

Also, if you have any control over the table structure here, break your LoanNumber field into two fields--it's clearly holding more than one piece of information.

Jeremy

---
Jeremy Wallace
METRIX Project Coordinator
Fund for the City of New York
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top