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

ADO / DAO Syntax to write to external database

P: n/a
I need to go over the hurdle of the connectivity syntax of ADO vs DAO.

I want to loop thru each record of table "A" in the current
database "X"

If condition is true in field "Y"
modify field "Z"
Append this record and all its fields to table "B"

Else
Ditto to table "C" in an external Database.

Endif

Thank you for showing me both versions ADO & DAO.

Wayne collins

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
One might call this ADO:

CurrentProject.Connection.Execute "UPDATE Transactions SET
Amount=Amount*-1 WHERE Day([Date])=13"
---------------------------------
One might call this DAO:

DBEngine(0)(0).Execute "INSERT INTO " _
& "[C:\Documents and Settings\Lyle Fairfield\My
Documents\Access\terrawaretables2.mdb].[transactions] " _
& "SELECT Date ,Account, Method, Details, Amount,Currency FROM
transactions WHERE Day([Date])=13"

CurrentProject.Connection.Execute
and
DBEngine(0)(0).Execute
are interchangeable, assuming references are correct.

In general, one does not use recordsets when one can use SQL.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.