Selasa, 14 Agustus 2012

[MS_AccessPros] CurrentDB.Execute versus DoCmd.RunSQL

 


This might be a simple question but could someone please give some
guidance on when to use CurrentDb.Execute strSQL and when to use
DoCmd.RunSQL strSQL as they seem similar.

I have a simple query "SELECT tblContacts.* INTO tblContacts_bck FROM
tblContacts;"

For the "Execute" option I seem to need:

Dim db As Database, strSQL As String

Set db = CurrentDb

strSQL = "SELECT tblContacts.* INTO tblContacts_bck FROM tblContacts;"

CurrentDb.Execute strSQL

whereas for the RunSQL option I only seem to need:

strSQL = "SELECT tblContacts.* INTO tblContacts_bck FROM tblContacts;"

DoCmd.RunSQL strSQL

Many thanks

Ray

[Non-text portions of this message have been removed]

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar