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

ADODB and Access Reports

I am trying to set a report's recordset property with an ADO recordset.
I do the following and it works on a form. What do I need to do to do
this correctly on a report?

Private Sub Report_Open(Cancel As Integer)

Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim strS As String

Set c = New ADODB.Connection

Set r = New ADODB.Recordset

strS = <a valid SQL statement>

With c

.CursorLocation = adUseClient

.ConnectionString = cTmarConnect 'constant for a connect string

.Open

End With

With r

.ActiveConnection = c

.CursorType = adOpenDynamic

.LockType = adLockReadOnly

.Open strS

End With

Set Me.Recordset = r

End Sub

This works fine on a form - take the exact same code and place in the on
open event of a form and I get the results I expect. In a report, I get
an error message that tells me

Run time error '2593'

This feature is not available in an mdb.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #1
5 5448
Tim:

The following KB article and the associated white paper addresses the issue
you are seeing. The bottom line is that you can only bind a recordset to a
report in an Access project (.adp). It will not work in a .mdb file.

http://support.microsoft.com/default...b;en-us;301987

--
David Lloyd
MCSD .NET
http://LemingtonConsulting.com

This response is supplied "as is" without any representations or warranties.
"Tim Marshall" <TI****@PurplePandaChasers.Moertherium> wrote in message
news:db**********@coranto.ucs.mun.ca...
I am trying to set a report's recordset property with an ADO recordset.
I do the following and it works on a form. What do I need to do to do
this correctly on a report?

Private Sub Report_Open(Cancel As Integer)

Dim c As ADODB.Connection
Dim r As ADODB.Recordset
Dim strS As String

Set c = New ADODB.Connection

Set r = New ADODB.Recordset

strS = <a valid SQL statement>

With c

.CursorLocation = adUseClient

.ConnectionString = cTmarConnect 'constant for a connect string

.Open

End With

With r

.ActiveConnection = c

.CursorType = adOpenDynamic

.LockType = adLockReadOnly

.Open strS

End With

Set Me.Recordset = r

End Sub

This works fine on a form - take the exact same code and place in the on
open event of a form and I get the results I expect. In a report, I get
an error message that tells me

Run time error '2593'

This feature is not available in an mdb.

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #2
I have done this in a ADP file.

I have found the report behaves so strangely afterwards that I have
discarded this procedure from my repertoire.

Nov 13 '05 #3
David Lloyd wrote:
Tim:

The following KB article and the associated white paper addresses the issue
you are seeing. The bottom line is that you can only bind a recordset to a
report in an Access project (.adp). It will not work in a .mdb file.

http://support.microsoft.com/default...b;en-us;301987


Thanks David, I'll look at this. A frantic google search later last
night confirmed the bottom line you mentioned. 8(

Forgive the profanity, but what half-arsed moron(s) at Microsoft needs
to be (figuratively, not literally) impaled on a giant razor blade for
this gross neglect? The ability to use ADODB DSNless connections was
something I was quite excited about; the Access report writer is an
absolutely wonderful tool with its ability to bind to data sources. I
would really like to kick somebody's ass for this. Goddamned bastards.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #4
ly******@yahoo.ca wrote:
I have done this in a ADP file.

I have found the report behaves so strangely afterwards that I have
discarded this procedure from my repertoire.


And, sadly enough, from David Lloyd's link and further research I've
done, ADPs are for SQL Server and I'm an Oracle user. I can still use
my DAO methods, but my hopes of dropping the shackles of having to run
around to users' stations to set up DSNs have been dashed.
--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Whatcha doin?" - Ditto "TIM-MAY!!" - Me
Nov 13 '05 #5
Tim Marshall <TI****@PurplePandaChasers.Moertherium> wrote in
news:db**********@coranto.ucs.mun.ca:
ly******@yahoo.ca wrote:
I have done this in a ADP file.

I have found the report behaves so strangely afterwards that I
have discarded this procedure from my repertoire.


And, sadly enough, from David Lloyd's link and further research
I've done, ADPs are for SQL Server and I'm an Oracle user. I can
still use my DAO methods, but my hopes of dropping the shackles of
having to run around to users' stations to set up DSNs have been
dashed.


Why? It's always been possible to do DNS-less ODBC connections. You
just can't have linked tables. You could write the connect strings
into saved queries, though, and use those to replace your linked
tables.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #6

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

Similar topics

1
by: Joris Kempen | last post by:
Hi people, I know that the question has come around sometimes: How to open an Access Report using ASP and export it to for example RTF. I'm trying to implement the first method of David...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
5
by: Steven Taylor | last post by:
Hope someone can help. I have an application whereby in order to create one document type I effectively print out 3 or 4 access reports in correct order. So the user goes to the printer,...
1
by: Brian Barnes | last post by:
I've been searching using google trying to find a way to display Access Reports via ASP.NET and only finding commericial products which appear to require that the report needs to be converted every...
1
by: David | last post by:
Does anyone know how to run MS Access reports from VB.net. I'd like to keep the existing reports in the database if I can. Thanks David
0
by: dkurtz | last post by:
D. Lesandrini published an article some time ago about exporting Access reports as XML, and then updating those XML reports dynamically in ..NET....
16
by: JoeW | last post by:
I'm utilizing a database that I created within MS Access within a program I've created in VB.NET. I am using the VB front end to navigate the information, but want to be able to print a report,...
3
by: booner | last post by:
Is there any way to show an existing access database (.mdb) report inside a vb.net application? Any/all pointers much appreciated. BBB
1
by: NeoDeGenero | last post by:
I have a little VBA/Access - Reports problem and I’m not sure on how to approach it: I am trying to send a Report generated by MS Access via email through the command SendObject. ...
0
by: Qtip23 | last post by:
Hello All, So I have a my database information placed on a SharePoint site now that there is an immediate need for a web-based application in my division. I am able to print Access Reports...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...

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.