Acces Query Window Updates But VBA execute of same SQL Statement doesn't update WHY?

Why is it that when i copy the following sql statement from the immediate window and paste it into the query window and hit run query, the query will update my table. But the this same query will not update my table if i use the currentproject.connection.execute method.

"UPDATE CreditCardDetail SET CreditCardDetail.Vendor = 'ZFUEL', CreditCardDetail.GlAccount = '6110.00' WHERE (((CreditCardDetail.ImportDate) Is Null) AND ((CreditCardDetail.CompanyName)='PBI') AND ((CreditCardDetail.YearMonth)='2016_08') AND ((CreditCardDetail.CreditCard)='Amex') AND ((CreditCardDetail.Description) Like '*7-ELEVEN*' Or (CreditCardDetail.Description) Like '*CHEVRON*' Or (CreditCardDetail.Description) Like '*CITY EXPRESS*' Or (CreditCardDetail.Description) Like '*CIRCLE K*' Or (CreditCardDetail.Description) Like '*MAVERIK*' Or (CreditCardDetail.Description) Like '*PILOT*' Or (CreditCardDetail.Description) Like '*REBEL*' Or (CreditCardDetail.Description) Like '*SHELL OIL*' Or (CreditCardDetail.Description) Like '*TEXACO*' Or (CreditCardDetail.Description) Like '*UNION 76*'));"
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

John TsioumprisConnect With a Mentor Software & Systems EngineerCommented:
how about running
Docmd.RunSQL yourSQL

Open in new window

I formatted your query in order to be easier to read
UPDATE CreditCardDetail
SET CreditCardDetail.Vendor = 'ZFUEL'
	,CreditCardDetail.GlAccount = '6110.00'
		((CreditCardDetail.ImportDate) IS NULL)
		AND ((CreditCardDetail.CompanyName) = 'PBI')
		AND ((CreditCardDetail.YearMonth) = '2016_08')
		AND ((CreditCardDetail.CreditCard) = 'Amex')
		AND (
			(CreditCardDetail.Description) LIKE '*7-ELEVEN*'
			OR (CreditCardDetail.Description) LIKE '*CHEVRON*'
			OR (CreditCardDetail.Description) LIKE '*CITY EXPRESS*'
			OR (CreditCardDetail.Description) LIKE '*CIRCLE K*'
			OR (CreditCardDetail.Description) LIKE '*MAVERIK*'
			OR (CreditCardDetail.Description) LIKE '*PILOT*'
			OR (CreditCardDetail.Description) LIKE '*REBEL*'
			OR (CreditCardDetail.Description) LIKE '*SHELL OIL*'
			OR (CreditCardDetail.Description) LIKE '*TEXACO*'
			OR (CreditCardDetail.Description) LIKE '*UNION 76*'

Open in new window

jb702Author Commented:
Yes, that worked, but why?. Ive used the currentproject.connection.execute method for years and never had a problem. What's the difference between the two.
All Courses

From novice to tech pro — start learning today.