473,410 Members | 1,937 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,410 software developers and data experts.

Problem setting Access Report Recordsource at runtime.

dsatino
393 256MB
I have a report based on query that is built dynamically at runtime. Because of the dynamic nature of the SQL, the report is modified at runtime to adjust the group levels and create the proper field references.

The problem, I guess because the query isn't optimized, is that it take anywhere from 1 to 2 minutes for the code to modify the report.

I've found that if the report has no recordsource then the code can modify the report in milliseconds as expected. So I'm trying to have the report modifications in place and then set the report's recordsource. Unfortunately, I'm getting a Visul C++ Runtime Error that only says 'abnormal program termination'.

From there, Access exits.

I've tried it in all of these ways:
Expand|Select|Wrap|Line Numbers
  1. Reports!rptComp2.recordsource="Comp2"
  2. Report_rptComp2.recordsource="Comp2"
  3. Reports!rptComp2.recordsource= Comp2SQL
  4. Report_rptComp2.recordsource= Comp2SQL
  5.  
Comp2SQL is a string function that returns the SQL behind the Comp2 query.

Other info:
The dynamic SQL works fine.
Comp2 returns the correct data every time.
The report does open fine as long as the recordsource is set before I open the report.
The report is open in design view when I try and set the recordsource.
I'm not getting a trappable error, just the 'abnormal program termination'.


Any help on why this is happenning would be great. Thanks.
Jan 12 '11 #1
1 1869
dsatino
393 256MB
Nevermind. It turns out that you can't, for whatever reason, set the recordsource property from an external sub.

I simply moved the recordsource to the Open event of the report and now it works fine.
Jan 12 '11 #2

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

Similar topics

1
by: ano1optimist | last post by:
Is it possible to create an ADO recordset as set it as the report recordsource? I was able to use this logic on forms but have been unable to use it on reports. HELP.
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
5
by: Prakash | last post by:
Hi, In my Access Report ... If there is "NO" entry i.e. (no corresponding CODE) in my Data-File, then even the Master-File entry does not show up in the report. eg. Mast-File Code Op.Bal
8
by: lauren quantrell | last post by:
When I open an Access form I can have no recordset specified, then in the form's OnOpen event I can do something like: Me.paramaters = "@SomeColumn = 22)" Me.recordsource = "dbo.sproc123" But I...
7
by: msrado | last post by:
Hi All, I have a report in Microsoft Access 2000 that appears with standard blank font in a print preview and shaded grey font in a printout. I don't want it to be shaded and can't figure out...
1
by: David Horowitz | last post by:
Hi folks. I need to create a report that has a Group Header that pulls certain data from the Detail section. It's something like this: +--Report---------------------------------------- |...
1
by: Hank | last post by:
I'm using Access 2000 and want to set up the dataset for a subreport. I trying to use the Forms!SubForms scenario as a guide but I cannot get it. Here is my try: Reports!!.Report.Recordsource =...
3
by: WindowsAndDoors | last post by:
Hey, I'm trying to assign to a report recordsource a variable name but I keep getting a message that the database isn't recognizing the control name. The name of the report is...
5
by: NJonge01 | last post by:
Greetings, I've read some great advice on similar topics, just nothing matching exactly what I'm trying I'm pretty close I think on making this work, but note quite there. I want to print a...
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?
0
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...
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
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...
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...
0
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,...
0
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...

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.