473,698 Members | 2,344 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Store and send reports by customer number Access 2016

62 New Member
I've looked through the site for this but nothing quite matches. I have an Access report for monthly accounts called rptAccount.
Each report is grouped by Customer code number, a 3 character number string (012) etc..
Is there a quick and easy (ish) way to send these accounts each month. They print separately but send as one big report. That is fine for archive. At the moment I have to go to Print Preview, save each report page as a pdf which requires about 6 clicks, then I have to go back to the archived pdfs and 'send' to email recipient. It's a bit long winded because there are usually 30+. Thanks for any help, macro if possible, not very conversant with VBA.
Mar 9 '18
58 4304
TrevorJ
62 New Member
Yes, it is on the cmdButton OnClick.
The gstrReportFilte r is in the correct code pasted into the form's Test_Click() procedure. It was the Report_rptAccou nt code that I placed the Dim in. I just commented it out and got the Variable not defined error so what should I do, I did copy and paste the code in?
I am sure that the code in the report is what you sent, it is the only code in the Report part. It's not easy to run through the code in the code window without the F keys. When I click on the menu to run I am confronted with a Create Macro dialogue which I don't understand. However, when I open the report the code stops at the IfLen line with the 'Variable not declared' error and the gstrReportFilte r is highlighted.
Yes, I will leave the 'DoCmd.SendObje ct' line as it is for now.
No I didn't mean I've given up with her, I meantthat sometimes it's prudent to give up debating something. I'm doing o.k. so far I think, 48 years at the moment.
Mar 21 '18 #51
twinnyfo
3,653 Recognized Expert Moderator Specialist
OK - so, very much my bad on this one. Sometimes I can't see the forest for the trees, and don't realize something obvious.

From your DB, go to the Create Menu, under Macros & Code, click Module. Put this in:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Public gstrReportFilter As String
Save it as "modTwinnyfoIsA nIdiotSometimes "

Delete the Public declaration statement in the Form.

All should now work.

Apparently--unbeknownst to me until I researched it and then actually tried it myself, declaring a variable as a public variable on a form does not behave the same way as declaring that same variable in a blank module. This was the assumption I was operating under, and I apologize for the length it has taken for this to be identified as an issue. Since I have always used global variables in stand alone modules, this has never been an issue, and I assumed declaring the same in a Form's module would function the same way. This is not the case.
Mar 21 '18 #52
NeoPa
32,569 Recognized Expert Moderator MVP
TrevorJ:
I'm doing o.k. so far I think, 48 years at the moment.
Well of course then! At that stage you'd be expected to have learnt enough wisdom to know not to argue with her any more than absolutely necessary. I'm nearly at that stage and only just over thrirty years in :-D Seriously, many congratulations to you both approaching your Golden Anniversary in a couple of years or so.

TwinnyFo:
Since I have always used global variables in stand alone modules, this has never been an issue, and I assumed declaring the same in a Form's module would function the same way. This is not the case.
This is a complicated one. Declaring a variable as Public within an Object's (Form or Report) Class Module does make it Public. What is different about such variables though is that they cannot be referenced simply from the Application object. They are members of different Objects so they need to be referenced as such. So, it would be referenced as Form_frmYourFor mName.gstrRepor tFilter. Not so straightforward .

So, unless you have a logical reason for storing such an item within an Object's Class Module rather than in a Standard Module, don't.
Mar 22 '18 #53
twinnyfo
3,653 Recognized Expert Moderator Specialist
NeoPa:
Thanks for the additional clarification. Although I had not tried, it, I was wondering if Form_frmYourFor mName.gstrRepor tFilter would work, and so apparently it does.

I use a series of global variables in my main DB, all decalred in a separate module that houses all my global constants, variables and some miscellaneous functions.

And so, I learn yet one more thing--this time, the hard way. However, now I am better able to advise others concerning this same issue.

About the time I figure all this stuff out it will be time to hangup my hat.

TrevorJ:
Congrats! I am only coming up on 14, but unfortunately this is my second go-round. But I know this one will last until Providence is pleased separate our immortal souls from our mortal bodies.
Mar 22 '18 #54
TrevorJ
62 New Member
Good morning, answers to your questions in post #50.
Yes, I have called the form 'Form_Test form to send rptAccount' and the only button in the form is named 'Test' (Caption Test click) and it's OnClick() event is all the code copied from your post #46 in the code block named Form code: I've just checked it and it is character for character o.k..
The 'Report Code:' block was the one that gave the Variable not defined error when I compiled the code so I put the Dim statement in for gstrReportFilte r and the error went away, I have now commented out the Dim.

Understood re. the report doesn't need to be open in any way.

I am certain that the code from post #46 named Report Code: has been copied and pasted to the rptAccount's VBA as Private Sub Report_Open(Can cel As Integer) Remember that I said that Microsoft had placed this in the Project browser and it has a notebook icon, not a module or class module icon. I have looked at Microsoft's explanation of icons at https://msdn.microsoft.com/en-us/vba...d-code-windows and there is no notebook icon.

Even I can see that the problem is related to the gstrReportFilte r now. It is difficult to step through the code with no useable function keys but I have managed to get a break point in various palces on the code, including the first line (after Option explicit line) and then clicked the report's command button. The code stops at the If Len(gstrReportF ilter) <> 0 Then line every time with the variable not defined error message.
The Dim statement that I put in is now commented out.

Gladly I didn't quite phrase my 'give up' status properly to NeoPa, what I meant was that I thought it was better to give up sometimes, than argue with my wife, I haven't given up on her though, nor her me. Were currently scoring 48 years.
Mar 22 '18 #55
twinnyfo
3,653 Recognized Expert Moderator Specialist
Now the only thing left in order for this to work (fingers crossed) is to create the standalone module from Post #52.....
Mar 22 '18 #56
TrevorJ
62 New Member
Hi Both,
Wait for it............. ..... it works! All I have to do now is some polishing and tidying, and if my daughter wishes, change the true for false on the DoCmd.SendObjec t line.
I had to change the name of the standalone module name though! Seriously, thank you, it has been an excellent learning opportunity and all's well that ends well.
Thank you both for your anniversary comments, I wish you both well with your journeys.
One mystery remains, in that apparently even Microsoft don't know what the notebook icon means in the VBA Project browser, I guess we may never find out.
And finally ... (Question moved to new thread -NeoPa).
Regards,
TrevorJ.
Mar 22 '18 #57
NeoPa
32,569 Recognized Expert Moderator MVP
TrevorJ:
I didn't quite phrase my 'give up' status properly to NeoPa, what I meant was that I thought it was better to give up sometimes, than argue with my wife, I haven't given up on her though, nor her me. We're currently scoring 48 years.
I suspect you're mistaken in thinking I didn't understand your comment :-) That explains my understanding quite perfectly ;-)

My comment suggests that your longevity together quite rightly has taught you that arguing with your wife is rarely a sensible thing to do. I expect she'd agree with me on that one Trevor - wouldn't you say ;-)

BTW I created a new thread (Difference Between Open and Load of Forms) with your latest question. This wasn't a criticism. Simply a way to allow that question to be searchable in its own right (and to award TwinnyFo the Best Answer which he deserves).

This current thread is too complicated for me to select a Best Answer. If either of you feels one post is where most of the value is shown then please feel free to select it.
Mar 22 '18 #58
TrevorJ
62 New Member
Thanks for your additional comments. I too just read the whole thread and found it impossible to separate out one that was the best. Suffice to say that success prevailed in the end - for all.
Mar 23 '18 #59

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

Similar topics

0
871
by: Konrad | last post by:
Hi I would like to know does is available Cystal Reports customer designer for VS.NET 2003? Thanks Konrad
33
13335
by: Prasad | last post by:
Hi, Can anyone please tell me how to store a 13 digit number in C language ? Also what is the format specifier to be used to access this variable ? Thanks in advance, Prasad P
0
1360
by: shwethatj | last post by:
Can anyone please help me..... In Crystal Reports , how to access data using PULL method .. I have got a table in server explorer which has 3 got fields. But i dont know how to access it and generate a report. Actually i have first selected ASP.NET website with c# language , then i added a crystal report using add item in solution explorer . Later i had setup a new data connection in server explorer. The new connection has got a database...
28
2044
by: DanicaDear | last post by:
I have set up a form to contain customer info. From that form, I have a button "Show Order" that links it to a Order Number form. That order number form contains a subform showing order details (qty, items). When I am on the customer info form and click SHOW ORDER it only shows me the orders associated with that particular customer number. (That is good.) But when I want to enter a new order, how can I get it to automatically fill in the...
9
9688
by: shalskedar | last post by:
Access can store how many maximum number of records for a db.. Wanted to know what is the limitation of total number of records that Access db can store
2
15628
by: CD Tom | last post by:
I've installed Office 365 and when I bring up Access the back ground color is White, I've looked in the File, Account, but when I click on the Office Theme I only get two choices Colorful, White, no matter what I choose I only get the white. In Access 2007 I had the I had a choice of Blue Silver or Black. How do I get my Blue back in Access 2016 any ideas. Thanks
1
3576
by: CD Tom | last post by:
I'm thinking about updating from Access 2007 to Access 2016 but have run into a problem. I can't find any place to compile my accdb to an accde. I've installed the office 2016 and can bring up my database with out any problems, but where is the make accde? Thanks for any help.
2
2281
by: Silver993 | last post by:
I have created Access 2016 Database with custom Icon. I can’t figure out what I am doing wrong. Here is the problem: When I tested the database in my developing Computer, it opens with my custom Icon and everything is great as expected. But when I move it to another computer that does not have Access 2016 installed and run my Database in Run-time (Accde), everything work OK. But the only problem is that my Application custom Icon got replaced...
1
2495
by: Murphy | last post by:
I am gettig ready to upgrade from Windows XP / Office 2007 to Windows 10 / Office Professional 2016. Are Access 2007 databases compatible with or convertible to Access 2016?
9
8715
by: mshakeelattari | last post by:
Is there any way to send SMS from MS access to Mobile phone numbers? I have Samsung Galaxy J5. Does it have ability to do so? I use MS Access 2016 on My laptop with Windows 10. Please give any shortcut possible way. Thanking in anticipation.
0
8680
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, 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...
0
8609
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8871
tracyyun
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...
0
7738
agi2029
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...
0
4371
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...
1
3052
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
2
2335
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.