473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

CreateReport Command not Using Template Report

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 2420
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
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>...
3
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...
0
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...
2
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...
10
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... ...
2
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...
3
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,...
3
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...
4
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
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...

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.