Modules & VBA :: Send Report With Variable Name
Jan 8, 2015
I use a macro that attaches a document automatically to an e-mail address ready to send this report is governed by a query of which the criteria is " loss order number " this is in a pdf format of which I need if possible
The problem I have is the same pdf file keeps attaching itself to the e-mail no matter which loss order number I select. The reason I think is because the report is called NCR so it is not changing from the previous one. What I think can solve it but not sure and don't know how to do is get the " loss order number " within the report name.
If I just send the report to a file direct it does work as I am prompted for a file name
Can the loss order number get into the file name within a macro/vba
Code:
Name="EMailDatabaseObject
Name="ObjectType">Report
Name="ObjectName">SEND NCR
Name="OutputFormat">PDF Format (*.pdf
Name="To">=[E-mail Address] & IIf(Nz([E-mail Address
View Replies
ADVERTISEMENT
Apr 30, 2014
I have some code in a form that calls for a public function and passes on some values. the function makes some calculations and assigns a value to the variable "percent" in the function itself.
How can I get the value of this variable back in the form so I can use it?
Form:
Code:
Private Sub Form_Open(Cancel As Integer)
Dim Table As String, TotalFields As Single
Table = "tblAdmission"
[Code]....
View 5 Replies
View Related
Apr 24, 2015
I have code that from DB1 opens DB2 and runs a Function in DB2.
The DB2 function produces a Boolean result that i am trying to get back to DB1 without success. Below is the script.
Sub Test22()
Dim AC As Object
Set AC = CreateObject("Access.Application")
rc = "K:ARSHRAutomation_ProjectsMikeFEDB2.accd b"
AC.OpenCurrentDatabase (rc)
AC.Visible = True
AC.Run "SendVariable"
End Sub
Because i am using AC.Run "SendVariable" i cant find a way to get the value of SendVariable!!
View 2 Replies
View Related
Nov 17, 2013
I use this to send email msgs through gmail, found it on the net somewhere, adapted a bit and it works.
Code:
Private Function fSendGmail() As Boolean 'Returns True if No Errors are Generated
On Error GoTo Err_ErrorHandler
fSendGmail = True
Const conStrPrefix As String = "http://schemas.microsoft.com/cdo/configuration/"
Const conCdoSendUsingPort As Integer = 2
[Code] ....
Err_ErrorHandler:
If Err.Number <> 0 Then fSendGmail = False etc, etc
End Function 'fSendGmail
I'd like to send report attached to this as pdf or rtf. How should I go about it. I know how to create pdf and save it.(DoCmd.OutputTo acOutputReport, "My Report", acFormatPDF, strPath, True) But where do I attach that here? Is it necessary to save the file first?
View 6 Replies
View Related
Mar 5, 2015
I would like to put 3 more people on as a CC but don't send the report
Code:
Dim strTo As String
Dim strSubject As String
Dim strMessageText As String
Me.Dirty = False
strTo = Me.E_Mail_address
[Code] .....
View 4 Replies
View Related
Oct 30, 2014
I have a VBA module in my Access 2010 database that will send a report as a PDF via email to a predetermined email address. the only problem using the docmd.sendobject method is i keep getting a pop up that says "A program is trying to send an e-mail on your behalf. If this is unexpected, click Deny and verify your antivirus software is up-to-date."
I have a windows task set up at the same time each day to open this database which runs an autoexec that creates this report and using my VBA module sends the email. i want it to just send the email without any imput from me. I want automation.
Here is my code that i am using to create and send the email
"Private Sub Report_Activate()
filename = "Name of file" & Format(Me.Date_time_returned "MMDDYY") & ".pdf"
DoCmd.SetWarnings False
DoCmd.SendObject acSendReport, "Name of file", acFormatPDF, "the destination email address goes here",,, "Request completed and sent " & Format(Me.Date_time_returned, "MMDDYY"), "Subject of email goes here", False
DoCmd.SetWarnings True
End Sub"
View 4 Replies
View Related
Feb 3, 2014
I have a report that I run manually from my computer every day.
This report is created by a macro in microsoft access, then it runs a VBA macro to send it out..
Is there a way that I can add this as a scheduled task since I usually forget to send it out?
View 3 Replies
View Related
May 19, 2014
Can you send a report directly to the printer? We have Clients with multiple Contact Notes, by multiple Clinicians, each of these are separate tables. Every month we print two reports for each client that had at least one contact in that date-range. Usually 200 clients, takes a lot of time. My approach so far is a query within a make-table query to get a list of unique client ID's that had one contact in the date-range. Then I use that table in code to create a recordset, use a Do Loop within that where I print the two reports for the 1st client, move to next record and loop. Now that I've got it working I'm not sure how to print all the reports My 1st question, can you send a report directly to the printer from code? The printer is a networked Konica Minolta Biz-hub so I think it can handle that many jobs being queued that fast.
View 4 Replies
View Related
Nov 6, 2013
I have some code that will allow a user to pass to it the name of a report. The code will do various things to that report before presenting it for Preview, opening in Word etc.
At one point in the code I would like to refer to some control or property of the report. If I was to include this directly for one report, I might type:
Reports!Annual_Budget_Report.Recordsource = xyz
But instead of a specifc report, it would be the report as a variable (srReport_Name). However, if I type:
Reports!stReport_Name.Recordsource
The code complains, rightly, that there isn't a report called stReport_Name. The stReport_Name variable is currently set as String. I *think* the answer might lie in the variable type, but I'm still struggling.
View 3 Replies
View Related
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 9 Replies
View Related
Jul 8, 2013
Error 91 - Object variable or With block variable not set
I am getting this error telling me that an object variable is not set.
I know which variable it is but when I step through the debugger it sets the variable and all is fine? Issue is that public variable of a class is not getting set when the VBA Editor is not open?
View 14 Replies
View Related
Oct 3, 2014
This code runs fine the FIRST time, however trows up a message the SECOND time it is run.
The error is on the line ".Range"
I am trying to sort records which have been exported to Excel.
Dim LR As Integer
LR = 5
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
Set wbRef = xlApp.Workbooks.Add
With wbRef
wbRef.Activate
.Worksheets("Sheet1").Activate
With ActiveSheet
.Range("A2", .Cells(LR, "O").End(xlUp)).Sort Key1:=.Range("C2"), Order1:=xlAscending, Header:=xlYes
End With
end With
View 3 Replies
View Related
Aug 20, 2014
I look at a lot of files to see when they were last updated. I wanted to write a generic procedure to manage that so ..
Code:
Public fDate As Variant
Public vField As String
Public vFile As String
'GTSdata
vField = "txt_gts_data"
[Code] ....
What I hoped Me.vField would do is update the date field [txt_gts_data] on my form with the date the file was last saved.
i.e. me. txt_gts_data = fDate
What actually happens is the variable vfield gets updated from "txt_gts_data" to 19/08/2014 then later code falls over because the fieldname is lost .
Me.[vField] corrects itself to me.vField (and does not work)
Me!vfield falls over (cannot find the field vField, not surprising J)
How do I say update the contents of the variable, not the variable itself?
View 7 Replies
View Related
Jul 11, 2013
I am wondering if it is possible to send a report as xls file and keep the format exactly as the report looks.When I try to send it now, it automatically changes back to the column names from the table, which I in the report have changed and want to keep in my excel output!
View 3 Replies
View Related
May 25, 2013
I have an unbound form with an associated report. When the user hits the 'print' button on the form/screen, the report is launched in the background. In the On Load event of the report I populate the report fields from the forms field as so:
Code:
Me.txtAddrMainLine2 = "NAME " & UCase([Forms]![frm_OrderRx].[txtPatientName])
This works like a charm as long as I call the report in Print Preview mode (i.e. with acViewPreview). But if I send the report directly to the printer, none of the fields print.
I've read about using other report events to populate the fields (e.g., On Format and On Print) and also something about using TempVars to pass the data. But I haven't read anything that's clear and definitive about the full answer.
View 3 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 18, 2004
I am trying to send an MS Access 'report' as an attachment to a mail recipient in rtf format without success. Everything seems to work fine except the 'send' button. Click away and nothing happens.... no error messages, no nothing. Any suggestions or tips on how to make this work?
Thanks...
View 2 Replies
View Related
May 13, 2013
I have an SQL statement which is dynamically built on a form.
It can be truncated to read
[Colour] = 'Blue'
Or it can be left as a complete statement - SELECT * from tblOrders WHERE [Colour] = 'Blue'
The statements work when I open a form.
Is there a simple way to open a report (or query) with these parameters?
View 6 Replies
View Related
Sep 26, 2013
I want to sent out my report as a pdf file with my macro.. I've been trying to use the VBA
Code:
Option Compare Database
Sub Fix1()
DoCmd.SendObject acSendReport, "MarketRiskControl_HighestDiffs_AsOfCurrentDate", "PDFFormat(*.pdf)", "my mail@mail", "cc", , "SD Counterparty Report as of Current Date", "Regards, Trading Risk Control", False
End Sub
But this doesn't work, get run-time error 2282..
I am using access 02.
View 1 Replies
View Related
Dec 4, 2011
How to create a new folder through the MkDir function, but my problem is, I then need my report to go to the new folder I just created.
For example:
the path is = "VAIOUsersDocumentsTownship" & Me.[Owner Name].Value
When I try to send the report there.. it only goes to "VAIOUsersDocumentsTownship" and not the new folder created titled with the owner name... the Me.[Owner Name].Value ends up getting set as the name of my report, in addition to the report name which is defined as the number.
My actual code is listed below:
Private Sub cmdFileReceipt_Click()
Dim strMyPath As String
If Me.cboMun.Value = "C-Town" Then
strMyPath = "VAIOUsersDocumentsC-Town" & Me.[Owner Name].Value
[Code] .....
View 14 Replies
View Related
May 2, 2006
Good Day!
I have a simple table where the user enter expiry date for visa. User also enter return date of visa holder.
I am looking for a way whereby, every time I start my database a report is automatically sent if Visa Expiry daye is close to departure date.
I already have the query and the report based on it, but how to have this checked and sent?
This is in my query
VISA_CHECK: IIf([Visa_LOI_end_date]-[Return Date]<7,'Fail','Pass')
If it fails this should trigger the report being sent.
I hope I have been clear and that someone can help.
Thank you in Advance
Enrico
View 2 Replies
View Related
Nov 9, 2006
Ok I saw this posted up in the forum but it was not explained.
I have a Query which asks for a parameter before giving an output.
I have a report that uses this query to display the information.
Ok what I am trying to do is create a form that has a textbox and I enter the parameter's information in that textbox or textbox. How do I send the information to the query?
The reason for such a thing is people tend to not follow the set guidelines for putting stuff in a parameter box. So what I decided to do was set up a calendar form which a person has to physically choose the date from the calendar and this leaves no room for real error. My problem is I can get the calendar information to the textbox or textboxes but can't figure out how to code the button to send the textbox information to the query & parameters & report, etc...
Can someone please help me out of this situation? or point me to a starting point?
View 4 Replies
View Related
Dec 13, 2006
Could you please help me and advise if it's possible to send report from MS Access by mail - having report as a content of an e-mail instead of attachement?
View 2 Replies
View Related
Nov 23, 2011
In Access 2007 there a way to send a report to a file you create from the information in the form?
Right now my code for the command button is:
Dim strMyPath As String
Dim strMyName As String
strMyPath =" EBEBMainDigital Sender "
strMyName = "Permit " & Me.[Permit Number].Value
DoCmd.OpenReport "File Current Permit", acViewPreview, , "[ID] = " & Me.[ID]
DoCmd.OutputTo acOutputReport, "File Current Permit", acFormatPDF, strMyPath + strMyName, False
DoCmd.Close acReport, "File Current Permit"
And that works perfect for sending the current report to the Digital Sender Folder... but I'd like to be able to send it to a certain county folder within the digital sender folder, based on what is listed for the county on the form. same for municipalities. and then, have it create a folder based on the name inside the form..... how to lead it through the path of the folder through the given information on the form, or how to make it create a folder.
View 9 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 29, 2013
Send only one or two pages of a multi-page report. I have a report that has three pages. I only want to send the first two as a pdf file. Can this be done with VBA? I know it can be done using Exporting Data on the External Data ribbon, but how can I do it via VBA?
View 4 Replies
View Related