Hello,
I have searched and followed many of the suggestions in the forum and have gotten to the point where I can send a query via email. The only thing I need to complete this project is the abilty to add a specific date to the end of the file name being sent.
Specifically, I have a query that is run using a specific date which the user enters into the field CTSI_Processingdate when the form opens. I need to have the date that was entered into this field concatenated to the query name so the resulting XLS file appears like something like "CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD) W_E 10_23_09".
I keep getting an error of "could not find object CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD) W_E 10/23/09.
Private Sub Ctl_Email2_Click()
Dim strMsg As String
Dim SL As String, DL As String
Dim emailsubject As String
Dim emailtext As String
Dim stfilname As String
Dim stprocessdate As Date
SL = vbNewLine
DL = SL & SL
stdocname = "CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD)"
stprocessdate = Me.CTSI_PROCESSINGDATE
stfilename = stdocname & " W_E " & stprocessdate & ".XLS"
emailsubject = "SGX Frieght Invoice Audit File for process week"
emailtext = "The attached file contains all invoice records for Singapore." & DL & _
"regards," & DL & _
"KK" & SL _
DoCmd.SendObject acSendQuery, stdocname & " w_e " & stprocessdate, acFormatXLS, _
"name@company.com", , , emailsubject, emailtext, True
End Sub
Any help would be very much appreciated.
I have searched and followed many of the suggestions in the forum and have gotten to the point where I can send a query via email. The only thing I need to complete this project is the abilty to add a specific date to the end of the file name being sent.
Specifically, I have a query that is run using a specific date which the user enters into the field CTSI_Processingdate when the form opens. I need to have the date that was entered into this field concatenated to the query name so the resulting XLS file appears like something like "CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD) W_E 10_23_09".
I keep getting an error of "could not find object CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD) W_E 10/23/09.
Private Sub Ctl_Email2_Click()
Dim strMsg As String
Dim SL As String, DL As String
Dim emailsubject As String
Dim emailtext As String
Dim stfilname As String
Dim stprocessdate As Date
SL = vbNewLine
DL = SL & SL
stdocname = "CTSI Weekly spreadsheet for APAC (5005_SGD & 5006_USD)"
stprocessdate = Me.CTSI_PROCESSINGDATE
stfilename = stdocname & " W_E " & stprocessdate & ".XLS"
emailsubject = "SGX Frieght Invoice Audit File for process week"
emailtext = "The attached file contains all invoice records for Singapore." & DL & _
"regards," & DL & _
"KK" & SL _
DoCmd.SendObject acSendQuery, stdocname & " w_e " & stprocessdate, acFormatXLS, _
"name@company.com", , , emailsubject, emailtext, True
End Sub
Any help would be very much appreciated.