Set forms recordset to a disconnected ADO recordset

Kodo

"The Shoe"
Local time
Yesterday, 22:07
Joined
Jan 20, 2004
Messages
707
Ok, I am trying something new here and it works partly. The result is that the forms record source is set and the rows that it displays are the proper count, but no data displays in them. I was working on helping someone else out in the forum when this idea hit me as a good solution, but I can't seem to get it to work 100%. I must be missing some minor detail that I'm not aware of.

PHP:
'---------not relevant to my problem-----------
Set objregexp = New RegExp
        
        objregexp.pattern = "\((\W*\w*)\)"
 
        objregexp.Global = True
        objregexp.ignorecase = True
        
Set Matches = objregexp.Execute(myvar)
'---------END IRRELEVANT CODE-----------


'---create disconnected RS---
 Dim RS As New ADODB.Recordset
 RS.Fields.Append "MyResult", adChar, 50
 
   RS.CursorType = adOpenDynamic
   RS.LockType = adLockOptimistic
   RS.Open "MyResult"

'--loop through the matches collection and add the value to the recordset
 For Each Item In Matches
     
        RS.AddNew
            RS("MyResult") = objregexp.Replace(Item, "$1")
        RS.Update
        
 Next

'--move it to the first record and set sub forms recordset to RS. 
 If Not RS.EOF Or RS.BOF Then
    RS.MoveFirst
    Set Me.Sub11.Form.Recordset = RS
End If
 



'---clean up objects
RS.Close
Set RS = Nothing





Set Matches = Nothing
Set objregexp = Nothing

Everything seems to work internally. If I do a debug.print on the RS, I do see ALL The proper data that I expect. Any clues?

Thanks! :)
 
Last edited:
don't want this to get too lost. ;)
 
*doobee doobee dooo* :)
 
*Crickets in the background*

I still can't find an answer for this.. beuller? beuller?
 
someone here has to know.. :confused:
 
I knew it was something rediculous..

Anyway, it appears that setting the controls control source to my field in the recordset displays the records. NOW, here's my next question. How do I set the control source of control on a subform..

If I do
me.[subformname].

it doesn't give me the control name.. am I missing something?
 
Right,
so I put a band-aid this one.

I checked to see if the recordsource was <>"" in my sub forms CURRENT event. Then if it was filled I set the controlsource of the control to the recordsource and also called FORM_CURRENT from the forms AFTERUPDATE event.

and there ya have it.
 
fixed it the way it should be.

referenced my subform like

FORMS_[subformname].[control].controlsource=

*I scratch my head because I could swear I tried that before.. and now it works.. I give in..*
 

Users who are viewing this thread

Back
Top Bottom