brianjohnson
Registered User.
- Local time
- Today, 13:55
- Joined
- Jul 29, 2003
- Messages
- 13
Hi All,
For some time I've been using Paul Sadowski's great CDO script to send mail from within Access 2003 and it has worked well including the use of a named file as an attachment. Into the future, I need to attach a file by reference rather than the exact file name ... but I can't get it to find the file (the system cannot find the path specified ...)
The file is created as here from within a form, key bits of code here ...
Dim LValue As Variant
LValue = DatePart("d", Now())
LValue = LValue & DatePart("m", Now())
LValue = LValue & DatePart("yyyy", Now())
Dim strqryname3 As String
dim strxlfile3 As String
strqryname3 = "qryexport"
strxlfile3 = Application.CurrentProject.Path & "\qryexport"
strxlfile3 = strxlfile3 & LValue
strxlfile3 = strxlfile3 & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strqryname3, strxlfile3
This all works fine. In another form and as part of the cdo process, I now need to reference this file to create the attachment ... here's the code line ...
objMessage.AddAttachment Application.CurrentProject.Path & "\" & strxlsfile3
... but as i say, the file can't be found ...
I've wondered if it's the scope of the variable across forms but that doesn't seem to be it. Can anyone point to where I'm going wrong?
Thanks all, Brian
For some time I've been using Paul Sadowski's great CDO script to send mail from within Access 2003 and it has worked well including the use of a named file as an attachment. Into the future, I need to attach a file by reference rather than the exact file name ... but I can't get it to find the file (the system cannot find the path specified ...)
The file is created as here from within a form, key bits of code here ...
Dim LValue As Variant
LValue = DatePart("d", Now())
LValue = LValue & DatePart("m", Now())
LValue = LValue & DatePart("yyyy", Now())
Dim strqryname3 As String
dim strxlfile3 As String
strqryname3 = "qryexport"
strxlfile3 = Application.CurrentProject.Path & "\qryexport"
strxlfile3 = strxlfile3 & LValue
strxlfile3 = strxlfile3 & ".xls"
DoCmd.TransferSpreadsheet acExport, acSpreadsheetTypeExcel97, strqryname3, strxlfile3
This all works fine. In another form and as part of the cdo process, I now need to reference this file to create the attachment ... here's the code line ...
objMessage.AddAttachment Application.CurrentProject.Path & "\" & strxlsfile3
... but as i say, the file can't be found ...
I've wondered if it's the scope of the variable across forms but that doesn't seem to be it. Can anyone point to where I'm going wrong?
Thanks all, Brian