Re: Problems with Runtime 2007
- From: Nutcroft5 <Nutcroft5@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sun, 29 Jun 2008 07:28:01 -0700
Hi Chris
Thanks for responding...i think it's the FileSystemObject that is failing as
it doesn't even get to opening the email bit. I wondered if it was a
reference issue? I had to download Visual Basic for one of the bits of code
i put in but I have been developing this database for so long i can't
remember if it was this one!
"Chris O'C via AccessMonster.com" wrote:
It's hard to make suggestions for troubleshooting when there's no error.
message or discription of which part is failing.
The runtime version requires more robust coding. New programmers usually
don't put error handling in their procedures, so when the runtime version is
running the db and an error occurs, it crashes.
Access 2007 also has security features that don't exist in earlier versions,
especially with VBA being disabled by default.
Is FileSystemObject or the kill command failing? Just guessing at what may
be blocked on your system.
Chris
Microsoft MVP
Nutcroft5 wrote:
Please help!
I have the following bit of code that has worked absolutely fine. However i
have packaged the database and it is failing on this bit of code. I have
installed it on a machine that has no previous version of access - only the
runtime 2007. I have another bit of code that just opens a blank email which
works fine and i have used late binding to avoid outlook reference problems.
I have tried removing the whole transfertext command and just using an
existing filename.txt but that still doesn't work. Any ideas??
Set db = CurrentDb
Set rs = db.OpenRecordset("path")
rs.MoveFirst
DoCmd.TransferText acExportDelim, "emailcontent export", "emailcontent",
"c:\FileName.txt"
Set olapp = CreateObject("outlook.application")
Set objmail = olapp.CreateItem(olMailItem)
Set fso = New FileSystemObject
Set strbody = fso.OpenTextFile("c:\filename.txt", ForReading)
bod = strbody.ReadAll
bod = Replace(bod, vbCrLf, "<BR>" & vbCrLf)
strbody.Close
With objmail
.HTMLBody = "Hi " & Me![First Name] & "<br>" & "<br>" & bod
.Display
.To = emailaddress
.Subject = "Welcome!"
Do
path = rs.Fields!Location
.Attachments.Add (path)
rs.MoveNext
Loop Until rs.EOF
End With
Kill ("c:\FileName.txt")
--
Message posted via http://www.accessmonster.com
- Follow-Ups:
- Re: Problems with Runtime 2007
- From: Chris O'C via AccessMonster.com
- Re: Problems with Runtime 2007
- From: pietlinden@xxxxxxxxxxx
- Re: Problems with Runtime 2007
- References:
- Re: Problems with Runtime 2007
- From: Chris O'C via AccessMonster.com
- Re: Problems with Runtime 2007
- Prev by Date: Re: DLookup returns Error '3464'-Data Type Mismatch in Criteria Ex
- Next by Date: Re: Problems with Runtime 2007
- Previous by thread: Re: Problems with Runtime 2007
- Next by thread: Re: Problems with Runtime 2007
- Index(es):
Relevant Pages
|