Data Access Page help needed

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi I am new to Data Access Pages and I have managed to create some simple web
forms based on tables and queries with little difficulty.

What I need to do now is create a recordset. I have used the code from msdn
as a starting point and get an error : "Microsoft Office Data Source Control
10.0: the "0" object cannot be found"

the problem seems to be as a result of this line:
strShapeText = MSODSC.RootRecordsetDefs(0).ShapeText

the full code is:
Dim rs
Dim strShapeText
Dim strConnString
Dim strDataSource
adOpenKeyset=1
adLockOptimistic=3

strDataSource = "C:\Folder1\DB1.mdb"
strShapeText = MSODSC.RootRecordsetDefs(0).ShapeText
strConnString = "Provider=MSDataShape.1; Persist Security
Info=False;Data Source=" _
& strDataSource & ";User ID=Admin;Data
Provider=Microsoft.Jet.OLEDB.4.0"

Set rs = CreateObject("ADODB.Recordset")
rs.open strShapeText, strConnectionString, adOpenKeyset,
adLockOptimistic

If err.Number <> 0 Then
MsgBox "Error: " & err.description & "Error " & err.number
End If

MSODSC.SetRootRecordset "query1", rsThemes

Any help will be greatly appreciated.

Thanks, Neal.
 
What 'code from MSDN' Neal? What's the URL?

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Hi Neal,

DAPs and VBScript are not my strong points. I'll try to work through the
problem with you if you want, but if you'd prefer to try
microsoft.public.access.dataaccess.pages, in the hope of finding someone
with more experience in this area, feel free to do so. And of course, if
anyone else wants to jump in here, please don't hesitate.

If you do decide to try to work through it here, here's what I've tried so
far.

I created a data access page, and dragged the Categories table from the
Northwind database to the data access page in design view. Then I dragged
the Products table to a new section below the Categories section. This gives
me a page that shows Category records from the Northwind database with a
plus sign, and clicking the plus sign shows Products related to the current
Category.

Next I copied the original code from the MSDN URL you posted, and pasted it
into the script editor. Your post doesn't show which event you're using, but
the MSDN code indicates the BeforeInitialBind event of the MSODSC object, so
that's what I used. It appears that my page never fires this event. I tested
by inserting a message box statement as the very first line in the code, and
never saw the message.

Assuming that your page is firing the event, do you have any thoughts on
what is different between my page, as I have described it above, and your
page, that might account for this?

BTW: Anyone else who tests the original MSDN code will quickly discover
there are two syntax errors in the code (line continuation characters in the
middle of string literals.) But those errors don't exist in Neal's modified
code, so that's not the problem.

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 
Hi Brendan,

Thanks for the effort. I did use that event and it did fire, not sure why it
did but your's didn't?

I just couldn't get past the "strShapeText =
MSODSC.RootRecordsetDefs(0).ShapeText" line. After the MSODSC object
intellisense wasn't giving me an option to use RootRecordsetDefs and there is
not much help about available on MSDN.

As a get around I wrote and ASP page and have brought that into my Access
app' so now it works and the code is really 'padded' out now.

However, it would be nice to know why the MSDN code did not work in the
first place. So if anyone does know I would be grateful.

Cheers,

Neal
 
I'd tend to go with ASP or ASP.NET myself, and one of the reasons is that
there's more documentation as well as more help from newsgroups and other
resources. I have to admit I'm curious too, though! :-)

--
Brendan Reynolds (MVP)
http://brenreyn.blogspot.com

The spammers and script-kiddies have succeeded in making it impossible for
me to use a real e-mail address in public newsgroups. E-mail replies to
this post will be deleted without being read. Any e-mail claiming to be
from brenreyn at indigo dot ie that is not digitally signed by me with a
GlobalSign digital certificate is a forgery and should be deleted without
being read. Follow-up questions should in general be posted to the
newsgroup, but if you have a good reason to send me e-mail, you'll find
a useable e-mail address at the URL above.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top