473,806 Members | 2,754 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

CreateReport Command not Using Template Report

69 New Member
All,

I'm creating a new report via code using the following lines:

Expand|Select|Wrap|Line Numbers
  1. Dim rpt As Report
  2. Set rpt = CreateReport(, "PIVOT_SUMMARY_tmp")
Problem is Access 2002 (VB) is not using the template report (denoted by "PIVOT_SUMMARY_ tmp") when it creates the new report. Access just uses the default report template which is a blank slate.

I'm pretty sure that I'm using the correct syntax. I've even referred to Mary McCarthy's article Create Dynamic Report using VBA, but I can't seem to figure out why Acceess wont use my template report.

Can anyone provide a few hints as to why Access isn't using my template report?

Thanks,
Scott
Dec 5 '07 #1
1 2442
sphinney
69 New Member
All,

I'm creating a new report via code using the following lines:

Expand|Select|Wrap|Line Numbers
  1. Dim rpt As Report
  2. Set rpt = CreateReport(, "PIVOT_SUMMARY_tmp")
Problem is Access 2002 (VB) is not using the template report (denoted by "PIVOT_SUMMARY_ tmp") when it creates the new report. Access just uses the default report template which is a blank slate.

I'm pretty sure that I'm using the correct syntax. I've even referred to Mary McCarthy's article Create Dynamic Report using VBA, but I can't seem to figure out why Acceess wont use my template report.

Can anyone provide a few hints as to why Access isn't using my template report?

Thanks,
Scott

All,

It took lot of digging, but I figured out the answer to my own question (mostly due to a post in another forum - dBforums). When using CreateRoport method in VB, the programer has the option of specifying a 'template' report. However, this option does not work as one might expect. The 'template' is only used for section size. VB will not 'copy' the controls and other properties that may have been setup for the template to the new report.

So, when creating a new report based of a 'template', you must use the following code:

Expand|Select|Wrap|Line Numbers
  1. Dim rpt As Report
  2.  
  3. DoCmd.CopyObject , "New_rpt", acReport, "Template_rpt"
  4. DoCmd.OpenReport "New_rpt", acViewDesign
  5. Set rpt = Reports![New_rpt]
Now that I look at it, it's like "duh"! Oh well, I hope this posting helps someone else in the future.

Scott
Dec 6 '07 #2

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

Similar topics

3
1739
by: Mike Partridge | last post by:
Is it possible to access your caller's (not parent) context while inside a <xsl:template match...> or <xsl:for-each...>? Here is the xml I'm using: <report-set> ...<report> .....<detail-data> .......<detail-column position="1" dsc="col1" sum_fg="0"/> .......<detail-column position="2" dsc="col2" sum_fg="1"/> .......<detail-column position="3" dsc="col3" sum_fg="1"/>
3
2480
by: Sandros | last post by:
Background: I'm collecting usability statistics for a group of applications. Each count has the following attributes: date, application, major heading, minor heading, count. My intent is to pull this back as XML and render it in to an HTML table. I have all this working and all the files are below. I would value any feedback. A simple example of the data looks like this:
0
6781
by: NOSPAM | last post by:
Guys, I get the 'There was an error executing the command' error message. I an using win xp & Access 2002. I created a database using the MS Access template 'Order Entry' I have entered about 97 customer enries so far.
2
3485
by: jess | last post by:
Hi, Im using the following code to make a new report based on an existing report. Set rpt = CreateReport(, "_SemiAnnualMaster") The problem that I am running into is that none of the report controls are coming across. All I end up with is a blank report. So, I manually copied all the Labels, Text boxes etc across..
10
1922
by: William Krick | last post by:
I am writing an XSL transform that converts XML data about vehicles into XML data that will fill printed forms. The default form can handle up to 5 vehicles which I handle using subscripts... <xsl:for-each select="VEHICLE"> <!-- spit out some stuff about this vehicle --> </xsl:for-each> <xsl:for-each select="VEHICLE">
2
17727
by: Senthil | last post by:
Hi All I need to create an Excel report and create a command button and have to run a macro on the click event that will print all the pages in the Excel workbook. I am able to create the report from the database but I am not sure how do I put a command button and associate a macro with that using C#. Can anyone help me?? Thanks in advance. Senthil
3
18722
by: creative1 | last post by:
Here is how you create a complex data report that involves parent and child commands and you can update information at runtime. Its pretty straight forward to work with simple queries; however, working with complex reports is tricky Assumption: Reader of this article have basic knowledge of creating data reports. Creating a Parent-Child Command and create a DataReport Suppose we have a database called company with two tables ...
3
1471
by: John Torres | last post by:
I am trying to copy a format from one of the template from Microsoft Website access database (Inventory Management Database) where when you go to Purchase Orders Form and there is a preview order button command at the bottom and when you click on it, it shows the current order shown on the form as a Report Type (it pulls a report). I made it as far as to pull the Report and even got the macros working but for some reason it shows all the report...
4
2694
by: ginge6000 | last post by:
Hi, I'm trying to create a report using a template and then set it's recordsource. I have tried Set rpt = CreateReport( , strTemplate) rpt.RecordSource = strQTableName but even though the template report exists and I have spelt it correctly I always end up with a blank report. So now I have tried DoCmd.CopyObject , strQReport, acReport, strTemplate DoCmd.OpenReport strQReport, acViewDesign, , , acHidden
0
9599
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
10624
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
10371
jinu1996
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...
0
10111
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...
1
7650
isladogs
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...
0
5546
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...
0
5684
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4330
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
3853
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.