By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,203 Members | 1,401 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,203 IT Pros & Developers. It's quick & easy.

Error Executing Query

P: 2
Hi All,

I am trying to execute a query in my VB Code for this Access application. THe code i have is:

Dim dbcon227 As Database
Dim qryDeff As QueryDef
Dim dbrs2, rs As Recordset
Dim strSQL As String

strSQL = "Update [Contract Line Items] set CONTRACTNO = tmpContractNo where CONTRACTNO = oldContractNo"
Set dbcon227 = CurrentDb
Set qryDeff = dbcon227.CreateQueryDef("", strSQL)
CurrentDb.Execute (strSQL) <<<--- this is where it breaks!!!

Any suggestions?

Sep 12 '07 #1
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 8,127
You need to frame the query properly.
Sep 12 '07 #2

P: 2
I fixed it already! Seems Access looks for ' ' around the values.

i.e., this code worked
"UPDATE [Contract Line Items] set CONTRACTNO = '" + tmpContractNo + "' where CONTRACTNO = '" + oldContractNo + "'"
Sep 12 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.