Eljefegeneo
Still trying to learn
- Local time
- Today, 04:51
- Joined
- Jan 10, 2011
- Messages
- 904
What am I doing wrong? This is my sql statement from the query:
And this is my SQL statement in my vba code:
The former works of course. Running the latter says it is an inconsistent SQL statement.
Where am I going wrong?
Code:
SELECT TOP 25 tblMain.ClientID, tblMain.FirstName, tblMain.Organization, tblMain.Email, tblMain.OnSendList
FROM tblMain
WHERE ((Not (tblMain.Email) Is Null));
Code:
Dim sSql As String
sSql = "SELECT TOP 25 tblMain.ClientID, tblMain.FirstName, tblMain.Organization, tblMain.Email, tblMain.OnSendList" & _
" FROM tblMain" & _
" WHERE ((Not (tblMain.Email) Is Null));"
DoCmd.RunSQL sSql
Where am I going wrong?