473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

object 91 variable ERROR

I have an app running on a number of `puters in A97 with no problems.
Has been running fine on 1 A2000 machine. Put an upgrade on tonight and got -
91 object variable or with block variable not set - message. when running the
following
References seem Ok
Compiles OK
Any thoughts ?
David B
code below -

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
Nov 12 '05 #1
3 5456
What line do you get the 91 error? That's Object not defined I believe. The
references may appear fine but you may not have a made a reference to a
referenced type. Identifying the line would help much.

David B wrote:
I have an app running on a number of `puters in A97 with no problems.
Has been running fine on 1 A2000 machine. Put an upgrade on tonight and got -
91 object variable or with block variable not set - message. when running the
following
References seem Ok
Compiles OK
Any thoughts ?
David B


<code snipped>

--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 12 '05 #2
Problem I have is this machine is a few miles away. Things run fine on all the
local machines
David B

John Mishefske <mi****@execpc.com> wrote in message
news:vm************@corp.supernews.com...
What line do you get the 91 error? That's Object not defined I believe. The
references may appear fine but you may not have a made a reference to a
referenced type. Identifying the line would help much.

David B wrote:
I have an app running on a number of `puters in A97 with no problems.
Has been running fine on 1 A2000 machine. Put an upgrade on tonight and got - 91 object variable or with block variable not set - message. when running the following
References seem Ok
Compiles OK
Any thoughts ?
David B


<code snipped>

--
'-------------------------------
' John Mishefske
'-------------------------------


Nov 12 '05 #3
David B wrote:
Problem I have is this machine is a few miles away. Things run fine on all the
local machines


The likely suspects are the variables that point to a DAO recordset and database and
the Outlook object. This is most likely a reference issue - you need to set a
reference to Microsoft DAO 3.6 Object Library (version dependent on your Access
version) and a reference to Outlook. Alt-F11, Tools, References and search for these
in the list and check them. If you find them marked as MISSING then un-click them,
close the references window and go back in and click them.

Check out: http://members.rogers.com/douglas.j....nceErrors.html
--
'-------------------------------
' John Mishefske
'-------------------------------

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

28
by: Daniel | last post by:
Hello =) I have an object which contains a method that should execute every x ms. I can use setInterval inside the object construct like this - self.setInterval('ObjectName.methodName()',...
7
by: William Apple | last post by:
Despite the fact this deals with webservices I believe it is a VB question. I am working on a test application that passes data to a webservice. The webservices takes a variable type that is...
5
by: eBob.com | last post by:
I am trying to change some Structures to Classes. The Classes now look like this ... Public Class OneAttr Public AttrName As String Public Column As String Public Caption As String End Class...
8
by: ST | last post by:
Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!!...
26
by: yb | last post by:
Hi, Is there a standard for the global 'window' object in browsers? For example, it supports methods such as setInterval and clearInterval, and several others. I know that w3c standardized...
6
by: Neo Geshel | last post by:
I am trying to deal with an image in code-behind. I consistently get the following error: Server Error in '/' Application. Object variable or With block variable not set. Description: An...
44
by: petermichaux | last post by:
Hi, I have been using the following line of code to create an object called "Serious" if it doesn't already exist. if (Serious == null) {var Serious = {};} This works in the scripts I use...
3
by: Richard Hollenbeck | last post by:
I've marked the line in this subroutine where I've been getting this error. It may be something stupid but I've been staring at this error trying to fix it for over an hour. I'm pretty sure the...
4
by: alex | last post by:
I am so confused with these three concept,who can explained it?thanks so much? e.g. var f= new Function("x", "y", "return x * y"); function f(x,y){ return x*y } var f=function(x,y){
3
by: Newbie19 | last post by:
I'm trying to get a list of all subfolders in a folder on a share drive, but I keep on getting this error message: Object variable or With block variable not set. Description: An unhandled...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.