Hi All
I have just built a database which i need to send various files via email to users. I've used functionality which i already have built in another database (and works fine) but for some reason, it is not working on this one
' SendSites
'
'------------------------------------------------------------
Function SendSites()
Set MySet = New ADODB.Recordset
MySet.Open "WandTEmail(ToSend)", CurrentProject.Connection, adOpenStatic
Do Until MySet.EOF
[Forms]![SendData].[QBucket].Value = MySet![Bucket]
[Forms]![SendData].[QEmail].Value = MySet!
DoCmd.SendObject acQuery, "SendW&TEmail", "MicrosoftExcel(*.xls)", [Forms]![SendData].[QEmail], "", "", "InsertEmail Text", False, ""
MySet.MoveNext
Loop
End Function
I have built a form called SendData and created two labels called QBucket & QEmail
I have built a Table called WandTEmail(ToSend) containing Bucket & Email
I have built a query called endW&TEmai which is linked to the form using the field Bucket and the following criteria [Forms]![SendData].[QBucket]
When I run this i get the following error
Run - time error '-2147217900 (8004oe14)':
Invalid SQL Statement; expected 'DELETE' INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE'
Any ideas folks? I have checked and double checked everything and it all seems to be set up correctly, but i'm sure i've missed something simple!
I have just built a database which i need to send various files via email to users. I've used functionality which i already have built in another database (and works fine) but for some reason, it is not working on this one
' SendSites
'
'------------------------------------------------------------
Function SendSites()
Set MySet = New ADODB.Recordset
MySet.Open "WandTEmail(ToSend)", CurrentProject.Connection, adOpenStatic
Do Until MySet.EOF
[Forms]![SendData].[QBucket].Value = MySet![Bucket]
[Forms]![SendData].[QEmail].Value = MySet!
DoCmd.SendObject acQuery, "SendW&TEmail", "MicrosoftExcel(*.xls)", [Forms]![SendData].[QEmail], "", "", "InsertEmail Text", False, ""
MySet.MoveNext
Loop
End Function
I have built a form called SendData and created two labels called QBucket & QEmail
I have built a Table called WandTEmail(ToSend) containing Bucket & Email
I have built a query called endW&TEmai which is linked to the form using the field Bucket and the following criteria [Forms]![SendData].[QBucket]
When I run this i get the following error
Run - time error '-2147217900 (8004oe14)':
Invalid SQL Statement; expected 'DELETE' INSERT', 'PROCEDURE', 'SELECT' or 'UPDATE'
Any ideas folks? I have checked and double checked everything and it all seems to be set up correctly, but i'm sure i've missed something simple!