Hello,
I'm a non_VBA coder who has been asked to update the following Function:
*************** ***********
Function EMAILER_REV_BY_ ACCTCODE_MACRO( )
On Error GoTo RA_EMAILER_Err
DoCmd.SetWarnin gs False
DoCmd.SelectObj ect acForm, "SalesAssoc ", False
DoCmd.SendObjec t acQuery, "Rev by AcctCode", "MicrosoftExcel (*.xls)", Forms![SalesAssoc]![e-mail], "", "", "Spreadshee t of Core Revenue for Current Month by Account", "Attached please find an Excel spreadsheet of the Core revenue for your Accounts. ", False, ""
DoCmd.RunComman d acCmdRefreshPag e
DoCmd.RunComman d acCmdRecordsGoT oNext
RA_EMAILER_Exit :
Exit Function
RA_EMAILER_Err:
MsgBox Error$
End Function
*************** *************** **
The function works fine, but the size of the unzipped Excel file is too large to send via email (mailbox size restriction). The user has WinZip installed on their computer. My thought is that the code needs to be modified so that the query is called and the results sent to an Excel file, then zip the file, then email the zipped file. I've tested zipping the Excel file, and the resulting size is well within the mailbox size limit.
How can I modify the above code to populate the Excel file with the query results, zip the file, then send it via email? I've searched online for some ideas, but have not really found anything.
The code is contained within an MS Access 2000 Module. The O/S is Windows XP SP2.
Thank you for your help!
cdun2
5 5773 Rabbit 12,516
Recognized Expert Moderator MVP
Hello,
I'm a non_VBA coder who has been asked to update the following Function:
*************** ***********
Function EMAILER_REV_BY_ ACCTCODE_MACRO( )
On Error GoTo RA_EMAILER_Err
DoCmd.SetWarnin gs False
DoCmd.SelectObj ect acForm, "SalesAssoc ", False
DoCmd.SendObjec t acQuery, "Rev by AcctCode", "MicrosoftExcel (*.xls)", Forms![SalesAssoc]![e-mail], "", "", "Spreadshee t of Core Revenue for Current Month by Account", "Attached please find an Excel spreadsheet of the Core revenue for your Accounts. ", False, ""
DoCmd.RunComman d acCmdRefreshPag e
DoCmd.RunComman d acCmdRecordsGoT oNext
RA_EMAILER_Exit :
Exit Function
RA_EMAILER_Err:
MsgBox Error$
End Function
*************** *************** **
The function works fine, but the size of the unzipped Excel file is too large to send via email (mailbox size restriction). The user has WinZip installed on their computer. My thought is that the code needs to be modified so that the query is called and the results sent to an Excel file, then zip the file, then email the zipped file. I've tested zipping the Excel file, and the resulting size is well within the mailbox size limit.
How can I modify the above code to populate the Excel file with the query results, zip the file, then send it via email? I've searched online for some ideas, but have not really found anything.
The code is contained within an MS Access 2000 Module. The O/S is Windows XP SP2.
Thank you for your help!
cdun2
You'll have to figure out the exact command line syntax but you can use Call Shell(" text") to run a command line program.
As for the e-mail, I've never e-mailed anything with Access so someone else will have to help you there.
I got this to work:
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, "Rev by AcctCode", "C:\Learning\Zi pExcelFile\Resu lts.xls"
The problem is, "Rev by AcctCode" is an MS Access Query that takes the following parameter value; Forms![SalesAssoc]![e-mail].
I need the parameter to get the correct results into the spreadsheet. How can I do this?
I have the code to send the email attachment (SendObject), and I have the code to zip the file. All I need is to figure out is how to use a parameter query with 'TransferSpread sheet' .
Thanks again!
MMcCarthy 14,534
Recognized Expert Moderator MVP
I got this to work:
DoCmd.TransferS preadsheet acExport, acSpreadsheetTy peExcel9, "Rev by AcctCode", "C:\Learning\Zi pExcelFile\Resu lts.xls"
The problem is, "Rev by AcctCode" is an MS Access Query that takes the following parameter value; Forms![SalesAssoc]![e-mail].
I need the parameter to get the correct results into the spreadsheet. How can I do this?
I have the code to send the email attachment (SendObject), and I have the code to zip the file. All I need is to figure out is how to use a parameter query with 'TransferSpread sheet' .
Thanks again!
Make sure the SalesAssoc form is open to the appropriate record and the TransferSpreads heet should work fine.
Mary
But there are other controls on the form. How can there be any association of the value in Forms![SalesAssoc]![e-mail] to the 'Rev by AcctCode' parameter query? I wouldn't think that when using TransferSpreads heet that when the query is a parameter query, that I can 'assume' the form field that holds the parameter.
MMcCarthy 14,534
Recognized Expert Moderator MVP
But there are other controls on the form. How can there be any association of the value in Forms![SalesAssoc]![e-mail] to the 'Rev by AcctCode' parameter query? I wouldn't think that when using TransferSpreads heet that when the query is a parameter query, that I can 'assume' the form field that holds the parameter.
It is the query that assumes the value. Try it and see.
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Raymond |
last post by:
Need to export an existing M$ Access 97 database to Postgres.
Tuples must be filtered as I am using sequences and other constraints.
Help from anyone that has experience with this or know of 3rd party automation
tools would be greatly appreciated.
Raymond
---------------------------(end of broadcast)---------------------------
|
by: Steven Stewart |
last post by:
I have a user who has been using Excel for a while to keep statistics
and print reports. She finds using it cumbersome because of long
formulas and a lot of copying and pasting.
I have designed a database for her which is intended to make things a
lot easier; however, I don't have a lot of experience with Access and
I find that designing the reports in Access is tedious. I want to be
able to print the reports (which are simply based on...
|
by: PerryC |
last post by:
Is there a way to export an MS Access Report to Word/Excel that looks
EXACTLY like it appears in Access? When I export to Excel, only
certain data appears, titles, headings... all missing. The format is
not aligned... When export to Word, all my lines (table lines) are
gone, making it hard to read.
Thanks.
Perry
|
by: Jonny |
last post by:
Hello,
I have created a button on my form which when pressed does the
following :
1) Run a pre-defined Macro, which is picking up a query and running my
data to excel.
However, I need the data to export into Excel in a certain format, i.e
it needs to begin importing at cell A4, and in truth it would be great
|
by: Hemant Sipahimalani |
last post by:
The following piece of code is being used to export HTML to excel.
HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"
HttpContext.Current.Response.AddHeader("content-disposition",
"attachment;filename=ABC.xls")
HttpContext.Current.Response.Write(strHTML)
HttpContext.Current.Response.End()
However when the user tries to save it the Default File Type is Web
Page(*.htm; *.html)
| |
by: smaczylo |
last post by:
Hello, I've recently been asked to work with Microsoft Access, and
while I feel quite comfortable with Excel, I'm at a complete loss with
databases. If someone could help me with this issue I'm having I'd be
most appreciative. The database is already constructed, I'm just
wanting to export the data to an excel file.
In short, I'm hoping to export two Tables (or queries...not sure which
to use - they both seem to have the same data) in...
|
by: CoolFactor |
last post by:
MY CODE IS NEAR THE BOTTOM
I want to export this Access query into Excel using a command button on an Access form in the following way I describe below.
Below you will find the simple query I am trying to export to Excel using a command in an Access Form.
RowID strFY AccountID CostElementWBS
1 2008 1 7
2 2008 1 7
I want to...
|
by: =?Utf-8?B?YzY3NjIyOA==?= |
last post by:
Hi all,
I have a question for you.
I have a .csv file which has many lines of data.
Each line has many data fields which are delimited by ",".
Now I need to extract part of data from this file but save it as an excel
file.
The data in this excel file will be imported into an Access database. The
|
by: cj2 |
last post by:
#1 Is there a quick way to export a datatable to an excel file? Or
delimited file?
#2 Where is the appropriate Microsoft monitored group to ask about
writing reports in SQL Reporting services or SQL Server Business
Intelligence Development Studio or whatever it's called?
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| | |