Modules & VBA :: Run Time Error 287 When Sending Emails
Dec 20, 2013
I have the following code in a module that sends out various email updates to me when I'm off site. On my PC it works perfectly whether I have Outlook open or not. I've installed the database on several other machines, but I'm getting a Run Rime Error 287 on the .Send line if the user has Outlook closed. Any setting somewhere in Outlook or Access that needs changing? Or is there something that can be changed in the code to ensure the email sends whether Outlook is open or not?
Code:
Public Sub SendEmailNotification(strSubject as String, strMessage as String, strAddress as String)
Dim olEmailApp As Object
Dim olMsg As Object
Dim strEmailBody As String
Set olEmailApp = CreateObject("Outlook.Application")
Set olMsg = olEmailApp.CreateItem(0)
[Code] ....
View Replies
ADVERTISEMENT
May 7, 2015
Using Access 2010; I have code that generates multiple emails to send using outlook. It works fine except that all emails go to my draft folder and I have to go the outlook and send them individually. This is fine when I have under 10 emails; but sometime it can get up to 50 or even 100 emails. What I have to do to send them from my draft all at once. The emails go to draft to inspect for errors.
View 1 Replies
View Related
Jul 19, 2013
In an Access 2007 module, is there a way of sending an email to a list of people stored as a list in a table in the database, rather than having to put all the names into the function?
I have a function I'm using to generate and send out an email to certain people, but the list is constantly growing so I'm looking for a better way to manage it! The main issue is having to kick users out of the database every time I need to update the recipients list... because it's stored in the code.
If I create a simple table containing all the names, how could I then ask it to use that instead?
This is the function I'm using currently - found on here and adapted to my own purposes
Syntax to use for the function: SendNotesMail "recipients", "Body Message", "Additional Text", "Subject"
Code:
Public Function SendNotesMail(strSendTo As String, strBody As String, strExtraText As String, strSubject As String)
'This public sub will send a mail and attachment if neccessary to the recipient including the body text and additional comments from the Active record
DoCmd.OutputTo acOutputReport, "REP09emailnotification", acFormatRTF, "x: endersgroup tendering databaseTenderUpdate.rtf", False
Dim Subject As String
Dim Attachment As String
[Code] ....
So I guess my question is: how do I get my recipients from a table into the strsendto?
View 5 Replies
View Related
Jul 15, 2013
At present I have a tblData, a tblPeople, a long union query and a report that displays its results. On a form I select a person from tblPeople (another field on that table contains their email address), run the query and report in that person's respect and email the results to them.
What I want to do is add a button which runs some VBA code which cycles through tblPeople, runs the query for each person, works out if the query has returned any records from tblData for that person, and if so - sends them the report.
I am using Access 2010
View 4 Replies
View Related
May 4, 2006
Hey
I have created a database system to book appointments between tutors and students in a school.
In the form, I want tutors to be able to send appointment details to students via email. I have created tables consisting of these details, however I don't know how to set it up for emails to be sent.
I am finding this very difficult especially with the visual basic codes. :confused:
Please help!
Thanks
ssslick x:)
View 3 Replies
View Related
May 30, 2005
Hi,
I have sent up a system were i email a table from access using the .sendobject function.
This all works fine. The problem i have is i need to attacted to emails to the same email. Any idea's how this can be achieved.
Thanks
View 2 Replies
View Related
Mar 9, 2015
I am using a form to send an email but part way in the process a message box pops up with 2 buttons labeled: Allow and Deny with some other information. I am forced to select allow in order for the send process to be completed.
Is there a way to prevent this popup so that the process completes smoothly without interruptions?
View 14 Replies
View Related
Jan 19, 2012
I have designed an Access database with a certain table called EmailAlerts.
This table has two fields: EmailMessage and Recipients.
The EmailMessage field stores the body of the mail to be sent to the corresponding email addresses in Recipients. E.g.:
EmailMessage | Recepients
Hello | abc@xyz.com
Goodbye | pqr@xyz.com
Now what I want to do is, whenever a record is added to this table, I want to send the email to the corresponding recipient. How can I do this?
View 5 Replies
View Related
Jan 26, 2012
Recently created a database with a form that the user provides problematic information. The form has a close button that has a macro attached that initated an emails and send the form information in a report to the end user . My problem is the function works great when the sender has a Outlook account. When the sender has a gmail account - the command will not work. I read that VBA can be written but I am not able to write SQL.My level with access is using built in functions and commands.
View 3 Replies
View Related
Nov 7, 2007
I'm using CDOSYS and SMTP in a vb function to send emails via Ms Access 2003.
My code loops through a recordset an sends an email to the email address in the table.
However, all works fine until an invalid email address is encountered, at which point I get an 'Invalid address' error message and the code halts (obviously). BUT, if use 'On Error Resume Next' I get no error message but all consequtive emails are NOT sent.
How can I get the code to ignore the invalid email and carry on sending emails throughout the recordset?
View 7 Replies
View Related
Dec 18, 2014
I'm trying to set email address for "Cc" using "Like" but showing error 13 Type mismatch. Problem only red mark code either all are working fine.
Code:
Private Sub cmdSendMail_Click()
On Error GoTo ErrorHandler
Dim strTo As String
Dim strSubject As String
Dim strMessageText As String
[code]....
View 14 Replies
View Related
Nov 14, 2012
Must Outlook be installed for Access to send emails?
Can I send emails from the Run-Time version of Access? (with and without outlook)
View 1 Replies
View Related
Mar 1, 2014
Previously my snapshot file was displaying thur this code but as 2010 Access, it produded subjected error and halt at below red color line.
Public Function LoadSnapshotFile(snpCtl As Object, strFilePath As String) As Boolean
Const conSnpFinishedDownload As Integer = 4
With snpCtl
.SnapshotPath = strFilePath
[Code]....
And it was runing well. But not now due to the produced error. I tried to make it pdf extension of the report file. It is updating the file at the path (where I kept the report) but problem is not displaying after click event on the form.
View 3 Replies
View Related
Aug 3, 2013
I have created a report in Access for around 800 uniquely identified line items. My end goal is to develop a script that will Print a PDF for each unique identifier and save them all in one folder and have each one named by unique identifier. Below is the script I have written, I cannot get through the Run-Time Error 91. The data is being derived from a SQL database.
Private Sub Command35_Click()
Dim rst As ADODB.Recordset
Set rst = Currentdb.OpenRecordset("SELECT DISTINCT [Unique_Identifier] FROM [tbl_questionnaire] ORDER BY [Unique_identifier];", dbOpenSnapshot)
[Code] ....
View 5 Replies
View Related
Jun 26, 2015
The task is (1) output an Access query to Excel (2) overwrite that file if it already exists (3) apply specific formatting to the header row and the other rows in Excel. I have cobbled the code together from two sources. The beginning and end are adapted from code on btabdevelopment.com but the large insert in the middle is code I got form a project a former colleague had done. But he's no longer around.
The problem: I click the button and everything works OK. The file is created and formatted just how I want. If I click the button a second time though, it seems to run OK, but when I open the file it is NOT formatted. However, theres another window behind it called Book 1 which has all the data and all the correct formatting it just hasnt been saved. If I click it a third time I get an error message that says Object variable or With block variable not set. Im not even 100% all that is accurate because I have tried it a multitude of ways, closing and re-opening the form, closing and re-opening Access itself, starting with Excel open or closed, never with the destination excel file open though. I dont seem to get exactly the same behaviour any two times. But as far as I can see, if I close and re-open Access, it always works the first time. So I can live with it.
Code:
Private Sub cmdExport_Click()
On Error GoTo Errhandler
Dim rs As DAO.Recordset
Dim oExcel As Object
Dim oBook As Object
Dim oSheet As Object
[code]....
View 8 Replies
View Related
Sep 10, 2014
I created a form for adding new data to an existing database and it worked just fine.
Today the form has decided to add time to the date field and this clashes with the table it import to.
Why/how it's changed the date format and how to change it back?
View 2 Replies
View Related
Feb 13, 2014
I have some code that creates appointment that i can send to colleagues, when I run the code first time it work all ok but the second time i run it i get a run time error see pic below
But I don't get any error's if i leave outlook open have also try the code on 2 pc's but stiil same problem
1392336756_tmp_run_time_error[1].jpg
Code:
Shell ("Outlook.exe")
Dim outMail As Object
Set outMail = Outlook.CreateItem(olAppointmentItem)
outMail.Recipients.Add (Me.txtsupervisor)
[Code] .....
View 3 Replies
View Related
Jun 11, 2013
I'm writing to an excel file from two separate Access tables, for which I'm using two separate DAO.Recordsets in VBA.The first table has 190 columns, the second table has more than 66 columns, so more than 256 columns will be written to the excel file.So I'm not expecting any error due to any maximum of 256 columns, but still I'm getting an error while trying to populate the 257th excel-column:
Run-time error '1004': Application-defined or object-defined error.(The same VBA works fine when I use another table with less columns.)Even more strange: on another computer I did not get the error and I was able to populate more than 256 excel-columns.
Code:
Option Compare Database
Option Explicit
Dim xlApp As Excel.Application
Dim xlWkb As Excel.Workbook
Dim xlWks As Excel.Worksheet
Dim FileNameOut As String
Dim RowNr As Long
Dim ColNr As Long
[code]....
View 5 Replies
View Related
Jul 6, 2013
When I enter character in input box then show run-time error with this code.
Code:
Private Sub cmdDelete_Click()
Dim password As String
If Command49.Visible = False Then
password = CStr("0" & InputBox("Enter Password"))
[Code] .....
View 3 Replies
View Related
Jun 12, 2015
I am trying to create a txt file to import into our accounting software. I get the file (its blank), but it fails on the WriteLine and i get the run time error. I have a command button on a form that the user will click to export the file.
Private Sub cmdExport_Click()
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim strPath As String
Dim strPathGB As String
[Code] ....
View 6 Replies
View Related
Nov 27, 2013
I am trying to call a stored procedure from access ,but it is giving me this runtime error :
Code:
2147217900
Syntax error or access voilation
I am doing this first time so i dont know about how to pass parameters (IN and OUT)..
My code is
Code:
Public Sub createDataToAnalyze()
Dim objConnection As New ADODB.Connection
Dim objCom As ADODB.Command
[Code].....
View 1 Replies
View Related
Apr 21, 2015
I'm trying to export queries from access to excel using the DoCmd option. The code (see below) works to a point - it exports some of the queries before I get a run time error:
"31532: Microsoft Access was unable to export the data".
The worksheet tabs also do not pick up the query name but instead return what looks like a temporary ID (e.g. ~TMPCLP118431). Have tried different file locations and versions of excel but the same thing keeps happening.
Code:
Sub ExportAllQueries()
Dim qdf As QueryDef
Dim db As Database
[Code]....
View 3 Replies
View Related
Dec 4, 2013
I am trying to create an INSERT statement from a form to put unbound fields in a table. The challenge that I am a getting is that I am getting a
Run-time error '3075' Syntax error in date in query expression '#'
What is really perplexing and perhaps something that may guide in identifying the culprit is that I have an identifcal form that uses the identical code and it works.
Here is the code below:
Dim strSQL As String
Dim strCriteria As String
strSQL = ""
strSQL = strSQL & " INSERT INTO [tblTicket]"
[Code] ....
View 4 Replies
View Related
Aug 11, 2014
I am getting Run-time error '3464': Data type mismatch in criteria expression when i execute the code:
Option Compare Database
Dim rst As DAO.Recordset
Dim rst1 As DAO.Recordset
Public verificacoes As Boolean
[code]....
View 5 Replies
View Related
Jun 16, 2014
I have a linked table to a DB2 database. this table contains key-pair values and has about 140k records.
I use a Sub to update the value of a specific record.
The sub starts by opening the needed DAO recordset
Then it uses the rs.Findfirst method
It checks if rs.Nomatch is not true (so the records exists!)
Then it starts updating the record with
rs.edit
rs!value1 = myvalue1,
rs!value2 = myvalue 2
rs.Update
There is where I get the '3021 No current record' error
I use the same sub on the same table to update to different parts. One part works the other gives me the error.
I have checked for typos.
View 5 Replies
View Related
Mar 14, 2014
On double click event in the listbox, code as below:
Code:
Private Sub ListBox_DblClick(Cancel As Integer)
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmTransactions"
stLinkCriteria = "[BinNumber] =" & Me![ListBox]
DoCmd.OpenForm stDocName, , , stLinkCriteria
End Sub
When I double click any row then it show Run time error 3464.
View 3 Replies
View Related