473,326 Members | 2,108 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,326 software developers and data experts.

Provide a Recordset to a report from VB via COM API?

Question:

I have a situation where I would like to prepare a Recordset object
within Visual Basic (6.0), and then use the MS Access COM API's to
Show a report built off of the data in my Recordset (e.g. NOT letting
MS Access get its own data through its normal Tables, SQL statements,
etc).

I tried the following code:

Set rs = CreateObject("ADODB.Recordset")
' fill in my recordset with some valid data
Set mdb = CreateObject("Access.Application")
mdb.OpenCurrentDatabase("C:\Path\To\My.mdb", False)
mdb.Visible = True
mdb.DoCmd.OpenReport("RptName", acViewDesign)
Set mdb.Reports("RptName").Recordset = rs
mdb.DoCmd.OpenReport("RptName", acViewPreview)

and am seeing the following error on the next-to-last line:

"You can't assign a value to this object."

I tried using an .ADP file as well, but to no avail.

I ran across one suggestion of opening a recordset (within Access
Macro code though, which I'd prefer to avoid), and then setting
Report.recordSource = rs.Name inside the Report_Open event. I'd try
this approach, but I can't figure any way to provide my RS to a valid
global variable within MSAccess (that the Report_Open event proc could
see).

Thanks in advance for any assistance, or pointers to a working sample,
etc...

- Kevin
Nov 13 '05 #1
0 1247

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Pragati | last post by:
Hi ! I have an SQL query which im developing on the click of a command button on a form. but am stuck up in creating a recordset of that query. how should one connect to database? use adodb...
22
by: Gerry Abbott | last post by:
Hi all, I having some confusing effects with recordsets in a recent project. I created several recordsets, each set with the same number of records, and related with an index value. I create...
1
by: Robert Davis | last post by:
I would like to be able to create a recordset in MS Access 2000 that allows a macro to run and create a report for each ID that appears in the recordset. So I thought that I would use a scheduling...
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...
1
by: Zlatko Matiæ | last post by:
Hello. I have a MS Access front end/PostgreSQL back-end combination. There is a report with nested graph (linked master/child fields). I used saved pass-through queries for both Record Source of...
6
by: Oko | last post by:
I'm currently developing an MS Access Data Project (.adp) in MS Access 2002. One of the reports within the DB uses data that is Dynamic and cannot be stored on the SQL Server. To resolve this, I...
10
by: nspader | last post by:
I want to start out saying I am a novice code writer. I am trying to send a report via email based on each supplier. The code below is what I am using. I need to base recordset on Form, report...
3
by: Gord | last post by:
Me again, I'm new to Access and am self teaching from a couple of books, so bear with me. (I've got a little experience with Visual Basic) As I understand so far, if I want to perform a bunch...
1
by: raddrummer | last post by:
Hi gang, I'm stumped on something that I've been at for a few days and so am seeking help. I'm sending emails to managers to let them know that a performace review is due and attach a custom...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.