473,406 Members | 2,208 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,406 software developers and data experts.

Runtime Error 2487

DJRhino1175
221 128KB
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?

Expand|Select|Wrap|Line Numbers
  1. Private Sub btnAuditEmail_Click()
  2.  
  3.     On Error GoTo Error
  4.  
  5.     Dim strEMail        As String
  6.     Dim strSubject      As String
  7.     Dim strBody         As String
  8.     Dim MyDB            As DAO.Database
  9.     Dim rstEMail        As DAO.Recordset
  10.     Dim strReportName   As String
  11.     Dim myReportWhere   As String
  12.     Dim myOutPutFile    As String
  13.     Dim aFile           As String
  14.     Dim strAtch         As String
  15.     Dim strMsg          As String
  16.  
  17.  
  18.         strMsg = "No Reject Tag Number. Please fill out the whole Reject Tag. Then try to resend"
  19.  
  20.         strReportName = _
  21.             Replace(Replace("REJECT TAG#|1 PN |2", "|1", Nz(" " & _
  22.             [REJECT TAG NUMBER], " ")), "|2", Nz([Part Number] & _
  23.             " " & [Descriptive Reason], " "))
  24.  
  25.         myReportWhere = "[REJECT TAG NUMBER] = [Forms]![Reject Tag Form Edit]![REJECT TAG NUMBER]"
  26.  
  27.         DoCmd.OpenReport _
  28.             ReportName:="Reject Tag Report", _
  29.             View:=acViewPreview, _
  30.             WhereCondition:=myReportWhere, _
  31.             WindowMode:=acWindowNormal
  32.  
  33.         myOutPutFile = "M:\Inspect\New Reject Tag Database\Reports" & _
  34.             "\" & strReportName & ".PDF"
  35.  
  36.         DoCmd.OutputTo _
  37.             Objecttype:=acOutputReport, _
  38.             Outputformat:=acFormatPDF, _
  39.             Outputfile:=myOutPutFile, _
  40.             AutoStart:=False, _
  41.             Outputquality:=acExportQualityPrint
  42.  
  43.         DoCmd.Close _
  44.             Objecttype:=acReport, _
  45.             ObjectName:="Reject Tag Report", _
  46.             Save:=acSaveNo
  47.  
  48.  
  49.         'Retrieve all E-Mail Addressess in tblEMail4
  50.  
  51. Set MyDB = CurrentDb
  52. Set rstEMail = MyDB.OpenRecordset("Select * From tblEMail4", _
  53.                 dbOpenSnapshot, dbOpenForwardOnly)
  54.  
  55. With rstEMail
  56.   Do While Not .EOF
  57.  
  58.     'Build the Recipients String
  59.     strEMail = strEMail & ![EmailAddress] & ";"
  60.       .MoveNext
  61.   Loop
  62. End With
  63.         Call MyDB.Close
  64.         Set rstEMail = Nothing
  65.         Set MyDB = Nothing
  66.  
  67.         strBody = _
  68.             "Please review the attached Reject Tag."
  69.         strSubject = _
  70.             Replace(Replace("REJECT TAG#|1 PN |2", "|1", Nz(" " & _
  71.             [REJECT TAG NUMBER], " ")), "|2", Nz([Part Number] & _
  72.             " " & [Descriptive Reason], " "))
  73.         strAtch = _
  74.             "M:\Inspect\New Reject Tag Database\Reports" & _
  75.             "\" & strReportName & ".PDF"
  76.  
  77.            Call SendAnEmail(olSendTo:=strEMail, _
  78.                          olSubject:=strSubject, _
  79.                          olEMailBody:=strBody, _
  80.                          olAtchs:=strAtch, _
  81.                          olDisplay:=True, _
  82.                          SendAsHTML:=True)
  83.  
  84.         aFile = _
  85.             "M:\Inspect\New Reject Tag Database\Reports" & _
  86.             "\" & strReportName & ".PDF"
  87.         If Len(Dir$(aFile)) > 0 Then _
  88.              Call Kill(PathName:=aFile)
  89.  
  90. Error:
  91.    MsgBox strMsg, vbCritical, "No Reject Tag number"
  92.    Exit Sub
  93. End Sub
Sep 28 '22 #1
6 22012
isladogs
456 Expert Mod 256MB
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
Sep 29 '22 #2
DJRhino1175
221 128KB
I ended up figuring it out...Thanks
Oct 3 '22 #3
isladogs
456 Expert Mod 256MB
Congratulations.
It may be helpful to others if you could explain what your solution was.
Oct 3 '22 #4
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?
Oct 23 '22 #5
DJRhino1175
221 128KB
That would be my guess. I just kept tinkering till it just decided to work. I believe it was in my filter somewhere.
Oct 24 '22 #6
NeoPa
32,556 Expert Mod 16PB
Hi DJ.

Frustrating, but I absolutely know what you mean :-D

Great that it's sorted anyway.
Oct 24 '22 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

5
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...
7
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...
7
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...
7
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...
2
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...
8
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...
7
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...
3
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...
2
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...
1
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...
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:
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...
0
marktang
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,...
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
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
isladogs
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...

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.