The code posted below creates an email in outlook. It works fine in A97.
However when one of my users moved up to 2000 then an error message - 91 object
variable or with block variable not set - and the routine appeared stuck in a
loop, needed ctr alt del to stop. Any thoughts on what is wrong ?
David B
Private Sub Command68_Click()
On Error GoTo Handler
If (Me!Textcount) = 0 Then
MsgBox "There are no records to send"
Exit Sub
Else
DoCmd.OpenQuery "bcmsdeletebirthtable", acNormal, acEdit
DoCmd.Close acQuery, "bcmsdeletebirthtable"
DoCmd.OpenQuery "bcmsbirths", acNormal, acEdit
DoCmd.Close acQuery, "bcmsbirths"
End If
Dim db As DAO.Database
Dim rs As DAO.Recordset
Set db = CurrentDb
Dim strMessage As String
Dim strsubject As String
Dim strspareline As String
Set rs = db.OpenRecordset("BCMSREGgrab")
If Not rs.BOF And Not rs.EOF Then
rs.MoveFirst
Dim olObj As Outlook.Application
Dim olMail As Outlook.MailItem
Set olObj = New Outlook.Application
Set olMail = olObj.CreateItem(olMailItem)
Set olMail = olObj.CreateItem(olMailItem)
Do
strMessage = strMessage & vbCrLf & Trim(rs![Tag No] & Chr(124) & rs![DateOB] &
Chr(124) & rs![Sex] & Chr(124) & rs![Breeds] & Chr(124) & rs![electID] &
Chr(124) & rs![Dam I D] & Chr(124) & rs![surrdamid] & Chr(124) & rs![Ear Tag] &
Chr(124) & rs![Holding No] & Chr(124) & rs![birthherdsuffix] & Chr(124) &
rs![Holding No] & Chr(124) & rs![postherdsuffix]) 'data
strsubject = Trim(rs![BCMSapplicID] & Chr(124) & rs![BCMSVno] & Chr(124) &
rs![BCMSorigionater ID] & Chr(124) & rs.RecordCount & Chr(124) & rs![timestamp])
'header
strspareline = ""
rs.MoveNext
Loop Until rs.EOF
With olMail
.Subject = ""
.Body = strsubject & vbNewLine & strspareline & vbNewLine &
strMessage & vbNewLine
.To = "da**@sis.defra.gsi.gov.uk"
.Send
End With
Set olMail = Nothing
End If
exitsub:
olObj.Quit
Set olObj = Nothing
rs.Close
Set rs = Nothing
Set db = Nothing
MsgBox "Email has been created. Open Outlook then press F5 to dial"
Dim stAppName As String
stAppName = "C:\Program Files\Microsoft Office\Office\outlook.exe"
Call Shell(stAppName, 1)
pbooClickTest = True
Exit Sub
Handler:
Select Case Err.Number
Case Else
MsgBox Err.Number & " " & Err.Description
Resume exitsub
End Select
End Sub 2 1587
Thanks for the reply. Checked references and were as they should be.
DB
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote in message
news:dn********************************@4ax.com... Check the references. The reference for OutLook in that database is probably still set for Outlook 97 (or 98), rather then Outlook 2000 (version 9).
On Wed, 15 Oct 2003 14:38:18 +0100, "David B" <da***@marleycotenospam.fsnet.co.uk> wrote:
The code posted below creates an email in outlook. It works fine in A97. However when one of my users moved up to 2000 then an error message - 91
objectvariable or with block variable not set - and the routine appeared stuck
in aloop, needed ctr alt del to stop. Any thoughts on what is wrong ?
-- When There's A Will, I Want To Be In It.
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote in message
news:va********************************@4ax.com...
<Snip> The other thing I would look at is how the conversion was done. Did they just allow Access to do it, or were the "recommended" steps followed (Decompile, compact, convert)? If you're unsure, you may want to use Lyle's BackThisUpText routine to accomplish much of the same thing in code. (If you don't have Lyle's routine, search for it at Google. Then keep it in your library of useful routines!)
Any more clues about Lyle`s routine. Havn`t been able to track it down.
TIA
David B
On Wed, 15 Oct 2003 21:24:24 +0100, "David B" <da***@marleycotenospam.fsnet.co.uk> wrote:
Thanks for the reply. Checked references and were as they should be. DB
Chuck Grimsby <c.*******@worldnet.att.net.invalid> wrote in message news:dn********************************@4ax.com.. . Check the references. The reference for OutLook in that database is probably still set for Outlook 97 (or 98), rather then Outlook 2000 (version 9).
On Wed, 15 Oct 2003 14:38:18 +0100, "David B" <da***@marleycotenospam.fsnet.co.uk> wrote:
>The code posted below creates an email in outlook. It works fine in A97. >However when one of my users moved up to 2000 then an error message - 91
object >variable or with block variable not set - and the routine appeared
stuckin a >loop, needed ctr alt del to stop. Any thoughts on what is wrong ?
-- When There's A Will, I Want To Be In It.
-- Okay, Who Put A Stop Payment On My Reality Check? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: James |
last post by:
I am currently working on a PHP based website that needs to be able to draw
from Oracle, MS SQL Server, MySQL and given time and demand other RDBMS. I
took a lot of time and care creating a...
|
by: NOSPAM |
last post by:
Hello,
I am hoping you can help me with the following problem; I need to process the following steps every couple of hours in order to keep our Sql 2000 database a small as possible (the...
|
by: Eivind Bjoraa |
last post by:
Hello
I have a server running .NET SDK v1.1 and MS SQL server
2000. I am using VS.NET v1.1 enterprice while some others
are running VS.NET v 1.0 professional.
The problems lies in adding new...
|
by: Julius Mong |
last post by:
Dear all, according to the ASV3 manual known problem section, to make an <a>
execute some Javascript onclick:
...
|
by: Seth |
last post by:
Hi all,
I am trying to get MS Project to create and save data back to DB2 via
the IBM ODBC driver. Both MSSQL and Oracle work, but when saving back
to DB2 it crashes leaving the DB with only...
|
by: byte.this |
last post by:
I have the Service Pack installed, but this program is just plain
buggy. I don't even WANT it, but I couldn't get my ATI drivers to
install unless I had it on the system.
I don't mind if the...
|
by: pb648174 |
last post by:
I recently needed to upgrade a sql 2000 machine to 2005. Instead of
upgrading the sql 2000 default instance, I installed sql 2005 as a
separate named instance so we could go back to sql 2000 if...
|
by: Lloyd Dupont |
last post by:
In my code I would like to use the constant (define in WinGdi.h)
CLEARTYPE_QUALITY
But that doesn't work!!
(it's for CreateFont(...))
A quick look at the header reveal that:
== WinGdi.h...
|
by: adstheman |
last post by:
Hi all,
I am maintaining a group of applications which share Access databases. In the newer version of the software products we have upgraded from DAO to ADO and also implemented routines to...
|
by: =?Utf-8?B?S2VuIExlbWlldXg=?= |
last post by:
My Clickonce app fails when the install button on the publish.htm page is
clicked.
User is prompted with a "Cannot Start Application" dialog.
Details provided from the dialog are:
PLATFORM...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |