I am using the code to attach a text file to an email. The weird thing is that this works perfectly on 3 machines and on th eother 3 it gives the error Runtimne error 3011, the Microsift Access database cannot find file 'Millvile_sandf#txt' Make sure the object exists...
It seems to me that the 3 messing up look at this as an import , not an export as called out. Ideas?
When I land my mouse on the filename in debug it is correct.
Public Sub Command78_Click()
Dim strErrMsg As String 'For Error Handling
Dim olApp As New Outlook.Application
Dim olNameSpace As Outlook.NameSpace
Dim olMail As Outlook.MailItem
Dim oleGrf As Object
Dim strFileName As String
Set olNameSpace = olApp.GetNamespace("MAPI")
Set olMail = olApp.CreateItem(olMailItem)
grantee = DLookup("[grantee]", "grantinfotable")
sandf = "c:\" & grantee & "_sandf.txt"
commev = "c:\" & grantee & "_commev.txt"
parev = "c:\" & grantee & "_parev.txt"
schev = "c:\" & grantee & "_schev.txt"
Play = "c:\" & grantee & "_play.txt"
Sites = "c:\" & grantee & "_sites.txt"
DoCmd.TransferText acExportDelim, , "Scope and Fidelity", sandf, True <- ERRORS ON THIS LINE
DoCmd.TransferText acExportDelim, , "Community Events", commev, True
DoCmd.TransferText acExportDelim, , "Parent Events", parev, True
DoCmd.TransferText acExportDelim, , "School Events", schev, True
DoCmd.TransferText acExportDelim, , "Sites", Sites, True
DoCmd.TransferText acExportDelim, , "play", Play, True
.To = "DHagerman@NJHI.org"
.Subject = grantee & " - Scope and Fidelity Data on " & DATE
.Body = "Data is attached. Save data on drive, then import to program."
.ReadReceiptRequested = False
MsgBox vbCrLf & "Data has been emailed! If asked be sure to answer YES to the Outlook prompt.", vbOKOnly
Set olApp = Nothing
Set olMail = Nothing