problem with recordset

R

Richard

i have created a recordset based on the records of a subform. It will loop
the records to get some information. It works when I tried it. But when I
save the form and open it again, click on the command to loop through the
subform, it runs as if there are no records (at debugging) even when the
subform shows there are records.

I go into design mode of the form, view the form again, tried the command
and it works. Close the form, open it normal - stop working again... Does it
need to be refreshed in some way? How do I overcome this issue?

Many thanks in advance
RIchard

part of the code:
Dim cnn As ADODB.Connection
Dim rs As Recordset
Dim strsql As String
Set cnn = CurrentProject.Connection

Set rs = Me.SubForm.Form.RecordsetClone

With rs
If Not (.EOF And .BOF) Then
'do someting
 
A

Allen Browne

Whenever the main form record changes, the subform's records are reloaded
(so they match the linked master/child fields.)

Therefore any recordset you create/assign does not survive once the main
form record changes.
 

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