Kamis, 26 Maret 2015

Re: [MS_AccessPros] db.execute query not working

 


Now I understand, the query is a SELECT query.
Follow up question:
Is it better to create the query in the VBA code or is it better to create the query in query design and save it and then call it from the vba code.
What is the better method or it makes no difference?.
Sarah

---In MS_Access_Professionals@yahoogroups.com, <JohnV@...> wrote :

Sarah-

If your query is a SELECT query, then you cannot use Execute.  What is the SQL of your query?

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Mar 25, 2015, at 9:43 PM, sarahk@... [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

I recall that it is better to use db.excute for a query than docmd.openquery.


I am struggling with the following, the same query works when I run it with DOcmd, but does not work with db.execute:



DoCmd.OpenQuery "mltc1bp2", , acEdit  (THIS WOKRS)
CurrentDb.Execute "mltc1bp2" (THIS DOES NOT WORK)


also tried

set DB=currentdb()

DB.execute and it does not work either.


However I have other queries that work fine with db.execute,.


What might be the reason?.


Sarah



__._,_.___

Posted by: sarahk@schemesoftware.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (4)

.

__,_._,___

Tidak ada komentar:

Posting Komentar