I have a code that emails a query as an excel spreadsheet.
I want to be able to add more code at the start to tell it: if no results in the query than don't open the email window.
This is what i have so far:
Private Sub Send_TAM_Button_Click()
On Error GoTo Err_Send_TAM_Button_Click
DoCmd.SendObject ObjectType:=acSendQuery, _
ObjectName:="Unauthorised DC's - TAM Query", _
Outputformat:="Microsoft Excel 97-10(*.xls)", _
To:="xyz@hotmail.com", _
Subject:="Unauthorised DC's - TAM", _
MessageText:="This email is self generated - Please arrnage for the attached DC's to be authorised and printed.", _
EditMessage:=True '
Exit_Send_TAM_Button_click:
Exit Sub
Err_Send_TAM_Button_Click:
MsgBox Err.Description
Resume Exit_Send_TAM_Button_click
End Sub
I want to be able to add more code at the start to tell it: if no results in the query than don't open the email window.
This is what i have so far:
Private Sub Send_TAM_Button_Click()
On Error GoTo Err_Send_TAM_Button_Click
DoCmd.SendObject ObjectType:=acSendQuery, _
ObjectName:="Unauthorised DC's - TAM Query", _
Outputformat:="Microsoft Excel 97-10(*.xls)", _
To:="xyz@hotmail.com", _
Subject:="Unauthorised DC's - TAM", _
MessageText:="This email is self generated - Please arrnage for the attached DC's to be authorised and printed.", _
EditMessage:=True '
Exit_Send_TAM_Button_click:
Exit Sub
Err_Send_TAM_Button_Click:
MsgBox Err.Description
Resume Exit_Send_TAM_Button_click
End Sub