As long as you add the quotes, you can use:
DoCmd.RunSQL "DELETE FROM tblName;"
For such as simple query, there is not really a point to declaring a string.
For a more complex query statement where you are concatenating values into
the string, declaring a string aids:
a) readability: you can see what's going on, and
b) debugging: you can:
Debug.Print strA
A more important issue is whether the query ran to completion or not. The
Execute method gives you much more flexibilty that RunSQL. Details in:
Action queries: suppressing dialogs, while knowing results
at:
http://allenbrowne.com/ser-60.html
--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users -
http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.
"J-P-W" <jo******@gmail.comwrote in message
news:11**********************@i42g2000cwa.googlegr oups.com...
>
Should I:
--------------------
Dim sqlA As String
sqlAll = "DELETE * FROM tblName;" '....or whatever!
DoCmd.RunSQL sqlA
--------------------
Or is it acceptable to just:
--------------------
DoCmd.RunSQL (DELETE * FROM tblName;)
--------------------
I know both work, but is there a reason I should use one over the
other?