subform - gotorecord - object name

G

Guest

hi ng,
trying to read the rows in a subform within in my access
2000 database, but it is not working.
have tried this:



for i = 1 to limit.

docmd.gotorecord, acdataform, "my_form", acnext

next i.

but, always the debugger tells me: object not open.

any helpful hint out there in cyberspace??

thanks in advance

jokobe
 
J

Jonathan Parminter

-----Original Message-----
hi ng,
trying to read the rows in a subform within in my access
2000 database, but it is not working.
have tried this:



for i = 1 to limit.

docmd.gotorecord, acdataform, "my_form", acnext

next i.

but, always the debugger tells me: object not open.

any helpful hint out there in cyberspace??

thanks in advance

jokobe
Hi jokobe
a subform must be referenced using a hierachy starting
from the main form.

[MainForm].[MainFormSubformControl].form

an alternative is to use the subform recordsetclone

dim rst as dao.recordset
set rst=me.recordsetclone

for i = 1 to limit
rst.bookmark=me.bookmark
rst.movenext
me.bookmark=rst.bookmark
next i

luck
Jonathan
 
J

jokobe

hi jonathan,

thanks for your fast answer. the trouble with the
reference is, that it is working for a field, but you
can't reference a subform properly within a gotorecord
command - the web is full with not working solutions.

the good message is:
your solution recordsetclone solution is working -
every now and then.
starting the code for the first time is fine,
starting the code again raises an error:
no object.
the recordset count returns in both cases 14 (that is
correct), but with the second start the i = 1 to limit
only runs twice, raising an error then. this is not
only a pity, but somehow unexpected.

alas, thanks again for fast and helpful hand

joachim
-----Original Message-----
-----Original Message-----
hi ng,
trying to read the rows in a subform within in my access
2000 database, but it is not working.
have tried this:



for i = 1 to limit.

docmd.gotorecord, acdataform, "my_form", acnext

next i.

but, always the debugger tells me: object not open.

any helpful hint out there in cyberspace??

thanks in advance

jokobe
Hi jokobe
a subform must be referenced using a hierachy starting
from the main form.

[MainForm].[MainFormSubformControl].form

an alternative is to use the subform recordsetclone

dim rst as dao.recordset
set rst=me.recordsetclone

for i = 1 to limit
rst.bookmark=me.bookmark
rst.movenext
me.bookmark=rst.bookmark
next i

luck
Jonathan
.
 

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

Top