I'm getting runtime Error 2487: The object Type argument for the action or method is blank or invalid
It triggers at line 36
I have been using this code for awhile, but all of a sudden it stopped working. Can anyone see something I have wrong? - Private Sub btnAuditEmail_Click()
-
-
On Error GoTo Error
-
-
Dim strEMail As String
-
Dim strSubject As String
-
Dim strBody As String
-
Dim MyDB As DAO.Database
-
Dim rstEMail As DAO.Recordset
-
Dim strReportName As String
-
Dim myReportWhere As String
-
Dim myOutPutFile As String
-
Dim aFile As String
-
Dim strAtch As String
-
Dim strMsg As String
-
-
-
strMsg = "No Reject Tag Number. Please fill out the whole Reject Tag. Then try to resend"
-
-
strReportName = _
-
Replace(Replace("REJECT TAG#|1 PN |2", "|1", Nz(" " & _
-
[REJECT TAG NUMBER], " ")), "|2", Nz([Part Number] & _
-
" " & [Descriptive Reason], " "))
-
-
myReportWhere = "[REJECT TAG NUMBER] = [Forms]![Reject Tag Form Edit]![REJECT TAG NUMBER]"
-
-
DoCmd.OpenReport _
-
ReportName:="Reject Tag Report", _
-
View:=acViewPreview, _
-
WhereCondition:=myReportWhere, _
-
WindowMode:=acWindowNormal
-
-
myOutPutFile = "M:\Inspect\New Reject Tag Database\Reports" & _
-
"\" & strReportName & ".PDF"
-
-
DoCmd.OutputTo _
-
Objecttype:=acOutputReport, _
-
Outputformat:=acFormatPDF, _
-
Outputfile:=myOutPutFile, _
-
AutoStart:=False, _
-
Outputquality:=acExportQualityPrint
-
-
DoCmd.Close _
-
Objecttype:=acReport, _
-
ObjectName:="Reject Tag Report", _
-
Save:=acSaveNo
-
-
-
'Retrieve all E-Mail Addressess in tblEMail4
-
-
Set MyDB = CurrentDb
-
Set rstEMail = MyDB.OpenRecordset("Select * From tblEMail4", _
-
dbOpenSnapshot, dbOpenForwardOnly)
-
-
With rstEMail
-
Do While Not .EOF
-
-
'Build the Recipients String
-
strEMail = strEMail & ![EmailAddress] & ";"
-
.MoveNext
-
Loop
-
End With
-
Call MyDB.Close
-
Set rstEMail = Nothing
-
Set MyDB = Nothing
-
-
strBody = _
-
"Please review the attached Reject Tag."
-
strSubject = _
-
Replace(Replace("REJECT TAG#|1 PN |2", "|1", Nz(" " & _
-
[REJECT TAG NUMBER], " ")), "|2", Nz([Part Number] & _
-
" " & [Descriptive Reason], " "))
-
strAtch = _
-
"M:\Inspect\New Reject Tag Database\Reports" & _
-
"\" & strReportName & ".PDF"
-
-
Call SendAnEmail(olSendTo:=strEMail, _
-
olSubject:=strSubject, _
-
olEMailBody:=strBody, _
-
olAtchs:=strAtch, _
-
olDisplay:=True, _
-
SendAsHTML:=True)
-
-
aFile = _
-
"M:\Inspect\New Reject Tag Database\Reports" & _
-
"\" & strReportName & ".PDF"
-
If Len(Dir$(aFile)) > 0 Then _
-
Call Kill(PathName:=aFile)
-
-
Error:
-
MsgBox strMsg, vbCritical, "No Reject Tag number"
-
Exit Sub
-
End Sub
6 22015
Hi
Apologies that your post ended up in the moderation queue and that there was a delay in approving it.
Hopefully it will be answered soon
I ended up figuring it out...Thanks
Congratulations.
It may be helpful to others if you could explain what your solution was.
NeoPa 32,556
Expert Mod 16PB
Hi DJ.
I assume you found that one of the values you passed as a parameter was invalid for that command. Can you confirm?
That would be my guess. I just kept tinkering till it just decided to work. I believe it was in my filter somewhere.
NeoPa 32,556
Expert Mod 16PB
Hi DJ.
Frustrating, but I absolutely know what you mean :-D
Great that it's sorted anyway.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bob Bamberg |
last post by:
Hello All,
I have been trying without luck to get some information on debugging
the Runtime Error R6025 - Pure Virtual Function Call. I am working in
C++ and have only one class that is derived...
|
by: wmkew |
last post by:
Hello everyone
I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with...
|
by: Yongsub Eric Shin |
last post by:
Hi. I'm just a beginner in ASP.Net.
I started writing codes and I keep on getting this Runtime
Error page, where it says
"Description: An application error occurred on the server.
The current...
|
by: yuanlinjiang |
last post by:
I am working on converting a win32 console application from VC6 to VC7.
My version is Microsoft Development Environment 2003 version 7.1.3088.
The code works fine on VC6. it is a console...
|
by: Aleksandar |
last post by:
Hi,
I need to convert set of Java classes exported from IBM Modeling environment
to C# for implementation.
When I invoke JCLA conversion from File->Open->Convert in Visual Studio 2005
it starts...
|
by: g_man |
last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of
a command button that closes the form. I have code in the Form_Error
event that does a good job of providing a more meaningful...
|
by: John |
last post by:
Hi Everyone,
I'm having this extremely annoying problem with Internet Explorer 6,
giving me an error message saying "unknown runtime error" whenever I
try to alter the contents of a <divelement...
|
by: Jim Armstrong |
last post by:
Hello all -
This is driving me crazy. I have a table called tblClients - very
simple, has the following fields:
taxID (PK)
ClientName
SalesName
The main form of my application allows a...
|
by: blogman |
last post by:
I am getting a Visual studio 2008 IDE application R6034 runtime error. This
means that the IDE application is raising the error not the application I am
building. This means that Microsoft did not...
|
by: abhijaiswal |
last post by:
Hi All,
I am working on a project where I used to views (view1 and view2). I set my first page as view2. I have around 10 Textboxes, 5 dropdown, 4 List view and 6 buttons.
When I run my web...
|
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
|
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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,...
|
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: 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: 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...
| |