Modules & VBA :: Create PDF Of A Report And Send It Via Email - Invalid Use Of Null
Nov 4, 2013
I am using Access 2007 and are a newbie.
I am using the following code (Sendobject) to create a PDF of a report and send it via email to a customer's email address.
Private Sub EmailWorkOrderQuote_Click()
On Error GoTo Err_EmailWorkOrderQuote_Click
Dim stDocName As String
Dim mFilename As String
Dim mEmailAddress As String
[Code] ....
It works fine except that the I want to to able to utilize the ability to send the email with either both the CC and BCC or either or neither as well.
I have a table called "My Company Information" that contains the email addresses for the CC and BCC. If I have values in these fields, everything works great! If I have no values in either of these fields, I get "Invalid use of Null"....
I want to be able to use either both CC and BCC, either CC or BCC, or neither used and it still work.
View Replies
ADVERTISEMENT
Mar 17, 2014
I have some code that takes from a query, an email address and sends out an email.Due the security warning that happens for each individual email, i want to create ONE email for all email address in the query and populate them to the BCC section of the sendobject.Here is the code that I currently use
Code:
Private Sub cmdSendEmail_Click()
Dim MyDB As DAO.Database
Dim rsEmail As DAO.Recordset
Dim sToName As String
Dim sSubject As String
Dim sMessageBody As String
[code]...
I want to populate the BCC field with multiple emails addresses seperated by ":" and send just one email.
View 4 Replies
View Related
Jul 5, 2013
It might be an easy one but I just wasted the past hour deciphering through my code in order to solve the run-time error '94' that I'm getting when trying to execute the following code:
Code:
Private Sub cmdUpdateDates_Click()
'###################################
'This sub aims at combining the timesheet date and the start and end time into the fields [Start Time] and [End Time].
'###################################
Dim intCounter As Integer
intCounter = 0
Dim rs As ADODB.Recordset
[Code] ....
View 1 Replies
View Related
Oct 26, 2004
I have created a form and housed in the form is a combo box that pulls info from managers I work with. I want to create a command button that I can click to send them an email. I have their information tabled and then have also converted that table into a form. I have their email address I just need to know how to properly code the command. I have no visual basic experience. I have had classes where I've coded in C++ and HTML but very limited.
Thanks
View 6 Replies
View Related
Jun 5, 2014
I am developing a database for my company which will produce reports based on data entered on various forms.
When the report opens, I would like its name to dynamically change to include the site, the client and their reference number. Although I know very little VBA, from searching this and other forums I have managed to get this to work on other forms.
On a different form, I have managed this by giving the form the caption "Caption" and then running the following code on load:
Reports("ItemisedQuoteFromQuoteFromViewSalesEnquiryFromSearch").Caption = "Our Quotation Ref: " & [StaffInitials] & "/" & [QuoteEnteredBy] & "/" & [QuotesJobsSalesEnquiryRecordNumber] & " - " & [ClientDetailsName] & " reference " & [JobsClientJobNumber]
Which will give the report a title along the lines of: "Our Quotation Ref: AB/CD/123456 - Client Name reference 987654".
On the report I am struggling with the code is:
Reports("MWUPropertyAssessment").Caption = "Property Assessment for " & [SiteDetailsAddressLine1] & ", " & [ClientDetailsName] & " reference: " & [PropertyAssessmentClientJobNumber]
However all this produces is "Property Assessment for , reference". If I try entering just "[SiteDetailsAddressLine1]", "[ClientDetailsName]" or "[PropertyAssessmentClientJobNumber]" I receive an Invalid use of Null error message.
If I create text boxes on the report for [SiteDetailsAddressLine1], [ClientDetailsName] and [PropertyAssessmentClientJobNumber] they are filled with the correct information so I know that these fields are not blank.
View 2 Replies
View Related
Jul 15, 2013
How to resolve error 94 in the following code:
Private Sub Form_Current()
Dim strTime As String
Dim strHour As String
Dim strMinute As String
If (CollectionTime.Value) = "" Then
MsgBox CollectionTime
[Code] .....
View 4 Replies
View Related
Sep 29, 2005
Hi Guys,
Im new to access and i have a problem!! I have a report that i need to be sent out monthly to 3 people. The problem is i dont know where to start. I have been looking through the forum, but nothing that i can get my head around, so there anyone out there who can help???????
Thanks in advance!!!
View 3 Replies
View Related
Aug 11, 2014
The basic idea is that I need to insert a record into a table and then return the Key field so that I can use it to populate another table. This was working just fine for a while, then it stopped and naturally I can't think of anything I did to make it not work. I get an Invalid Use of Null error at the bolded step.
Dim SQL As String
Dim SpecID As Long
Dim VerifySpec As Variant
' Check for empty strings
If Len(Me.txtNewPartNumber & vbNullString) = 0 Then
Response = MsgBox("Part Number cannot be blank.", vbExclamation, "Missing Data")
Exit Sub
End If
[code]....
View 6 Replies
View Related
Oct 1, 2013
I like this form I have that allows me to send attachment when email is entered.However, I would like to have a list box of Name and Email Address. when selected the email address is now set (same as before but just as a drop down) I type my message etc...But the attachment part I would like to send a specific report (that connects to that email address) so that it will only send jobs connected to that person.
Here is the code below:
Private Sub Email_Output_Click()
'
' Email API Outlook example programming code
' Send email from to Outlook
'
Select Case Me.Email_Output_Option
[code]....
View 9 Replies
View Related
Jun 16, 2013
The following code works fine until it gets to last record, then it give me Error # 94 Invalid use of null. I have searched all of my code and null is not in the code.
Code:
'--------------------------------------------------------
' Goes to next record
'---------------------------------------------------------
Private Sub cmdNext_Click()
On Error GoTo err_handler
' DoCmd.GoToControl (txtNameL)
' DoCmd.GoToRecord , , acNext
[Code] .....
View 14 Replies
View Related
Sep 17, 2013
I have a template report (R_CurrentJobs) with fields from database.
Fields: FirstName, LastName, Email, JoB Number, TechID, TechName, JobLocation etc...
The query Q_CurrentJobs is a list of jobs to send to the tech for today. (These are open jobs queried).
I need to run this query on the report (R_CurrentJObs) and send the report to each tech based on their individual jobs. The jobs are connected to each tech by its TechID.
The report list the job information for each tech (JOb number, Location details etc.)
When I click the button to send the email. I want to email each tech individually based on the Q_CurrentJobs query using R_CurrentJobs. (DoCmd.SendObject)
View 11 Replies
View Related
Sep 9, 2013
I need to send the report using DoCmd.SendObject. However, I need to send it based on each tech's job via email.
Currently all tech and jobs on the reports together. I need it to pull the email address and only send to that tech its jobs.
Currently I'm using the basic vba code
DoCmd.SendObject acSendReport, "R_DispatchInspectors", acFormatPDF, "email@me.com", , , "Job number", "Please see attached", False
However do I allows this to send individual report connected to email address. (Which will have each tech's specific jobs sent to them only).
table name: Inspectors (this one have their email address)
Table name: JObs
Report name: R_DispatchInspectors
View 3 Replies
View Related
Sep 2, 2013
i have these code to auto generate member number but the highlighted line generate error 94 - invalid use of NULL:
Private Sub cmdGetNumb_Click()
'On click of button a new Member Number is generated and
'focus is moved to tFName field.
Me![nMembNum] = NewMembNum()
Me![tFName].SetFocus
'Prevent accidental click
Me![cmdGetNumb].Enabled = False
[Code] ....
View 2 Replies
View Related
Feb 11, 2014
I have the code for sending an email but I only want to send a single email when there are records in a query and only when the database is first opened.
I hadn't considered this in my design so what structural requirements would it require if any?
View 5 Replies
View Related
Aug 1, 2013
I have an Access 2010 database which has a table with several fields with the Hyperlink data type. Some of these hyperlinks reference files stored in a SharePoint database. I am relatively new to using hyperlinks. The task is to insert those hyperlinks into an email using VBA so that the recipient can just click on them to view the documents.
I have no problems with using VBA to create emails or to add attachments. My issue is with adding hyperlinks to the body of the email.
View 12 Replies
View Related
Jul 2, 2015
I have a several templates in outlook 2003 for my charity work.
All is OK if I send the odd one now and again, but the workload is increasing with more and more at any one time. However having seen various posts on here, I was thinking I could set something similar in Access as well as keeping track of the payments & deposits more easily.
I am fine with to, cc,bcc, body, subject etc, but what I need to do is SendUsingAccount, but 2003 does not have this property, it started with 2007.
As well as sending on that particular account I also need the signature linked to that account.
I could add that signature by code if I can get the correct account and for some reason the signature is not added.
I tried using SendOnBehalfOfName which works as far as the correct email address is used, but still uses my default a/c.
As an aside, my Outlook session would always be open, so I will use GetObject and not CreateObject method, but would like not to have the warning dialogue in Outlook pop up all the time.
View 14 Replies
View Related
Nov 18, 2013
I am struggling trying to execute a function inside a Form_current event to display some stats.
The Function is this:
Code:
Function FlightsByAircraft(Aircraft As Long) As Long
Dim rst As DAO.Recordset
Dim dbs As DAO.Database
Dim str As String
str = "SELECT * FROM tblFlights WHERE AircraftID = " & Aircraft
[Code] ....
The code for the Form_Current event is this:
Private Sub Form_Current()
txtStats1 = FlightsByAircraft(Me.AircraftID)
Very simple. Well, the problem is when I move to a new record, a error message comes up: "Run-time error '94' - Invalid use of Null". It is because the AircraftID is not populated at that time. I tried to insert in the function code something like that:
Code:
If IsNull(Aircraft) then
exit function
else
.... (the DAO.Recordset code)
but it doesn't work.
View 8 Replies
View Related
Jan 15, 2015
With the code below , I send the report: “ESERT4H”, in email body. How I could add yet another report on the same body of the email ?
DoCmd.OutputTo acOutputReport, "ESERT4H", "HTML(*.html)", "D:Access empESERT4H.html", False, "", 0, acExportQualityScreen
Dim Out As Outlook.Application
Dim NS As Outlook.NameSpace
Dim Folder As MAPIFolder
Dim Mens As MailItem
[Code] ....
View 7 Replies
View Related
Aug 13, 2014
I have inventory database, in database there is "NextScheduledMaintenance" field.
I want access to send email automatically when scheduled maintenance date due.
View 7 Replies
View Related
Feb 3, 2014
I'd like a command button to open Outlook and create a new email message with the To and Subject fields already populated with what I want, is there anyway to do this?
View 1 Replies
View Related
Aug 17, 2015
Is it possible to send an email from an access 2007 database with a category?
View 8 Replies
View Related
Oct 18, 2013
I am setting up a database to track preventative maintenance required for testing equipment in our repair shop. Some of my associates would like to be able to send e-mail notifications via the database when maintenance is due. I set up a query to show the people who need to receive an e-mail and a query to show the maintenance each person needs to perform.
Each person will need to perform more than one maintenance step each time. I would like to get it so that the database will loop through the first query and generate one e-mail for each person. I would like the e-mail to list all the steps that person would need to do (as shown in the second query). I know this would require setting up loops and I'm afraid I'm not very good at writing loops.
I think this will need two loops. One to loop through the first query to see all the e-mails that will need generated and one to loop through the actions to be included in each e-mail. The person's name is included in both queries and can be used to set up a link between the two.
View 5 Replies
View Related
Dec 17, 2013
I'm using ACCESS 2010. I have a form which is having a embedded word document. What I'm trying to do is i want to enable user to format a mail in the embedded word document which will contain rich text and screenshots then with a click of button an outlook mail should open and content of this document should be pasted there. Once user sends this email, I want to save content of embedded document in the database.
View 4 Replies
View Related
Jul 31, 2013
What is the best way to send a single email to multiple recipients?
View 14 Replies
View Related
May 30, 2014
I currently have two e-mail accounts on my computer. One is my default e-mail address with my name on it. The other e-mail account is a generic account with the department name.
I have a database set up to generate and send e-mails to our technicians notifying them when an order they placed gets put on back order. This database could possibly send twenty or thirty e-mails out each time it is run. My manager has requested that the database send the e-mails from the generic e-mail account instead of the default account. That way, when the field replies to the e-mail, they won't bombard my account.
Is there a way to tell the database which e-mail account to send an e-mail from?
I am currently using the below module to send the e-mails:
Option Explicit
Dim appOutlook As Outlook.Application
Dim namespaceOutlook As Outlook.NameSpace
Sub Outlook_SendMail(sEmailAddr As String, sEmailSubj As String, sEmailBody As String, Optional sAttach1 As String, Optional sAttach2 As String)
[Code] ....
View 2 Replies
View Related
Jan 4, 2014
Is there a way of doing the above? I have several distribution lists (some >100 recipients) defined in Outlook, and would like to use the Docmd. Send Object command to send messages to one or several of them. I cannot find a way of defining a distribution list as any of the To, Cc or Bcc parameters.
View 2 Replies
View Related