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 21987
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,554
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,554
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: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM).
In this month's session, the creator of the excellent VBE...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: Aftab Ahmad |
last post by:
Hello Experts!
I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: marcoviolo |
last post by:
Dear all,
I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
| |