How to set the Recordset for a Subform

O

Optimo

How can I link a subform to a recordset in such a way that when I browse the
recordset of the parentform the linked records are shown in the subform?
 
A

Alex Dybenko

Hi,
you can use main form current event to apply filter to subform. you can also
bind both forms to appropriate tables/queries and then set subform control
master/child fields properties. Try to run access new form wizard and it
will assist in this

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
 
O

Optimo

Thanks Alex,

But what I mean is that I want to link the subform to a ADODB recordset.
The parentform has no recordset, query or table linked to it.
 
O

Optimo

Hi Alex,

As the parentform is bound to a ADODB record set, let say the recordset
rstAddresses, clicking the appropreate command buttons, the commands
rstAddresses.MoveFirst, rstAddresses.MovePrevious, rstAddresses.MoveNext,
rstAddresses.MoveLast are executed and this works perfectly.

I also created a Popupbar based on "Form View" with the Find, Sort Ascending
and Sort Descening icons/commands in it. This Popupbar is 'attached' to the
parentform via the properties "Shortcut Menu" and "Shortcut Menu Bar".
The Find command works, but the Sort commands make the recordset and the
parentform to 'disconnect': the browse buttons still work, but it's not shown
anymore in the form after the recordset is sorted.
 
O

Optimo

That would mean that I need an event to trigger that.
I tested almost all probable events that could be triggered by that sort
command:
OnDataChange
OnAfterFinalRender
OnAfterUpdate
OnApplyFilter
OnBeforeRender
OnCurrent
OnDataChange
OnDataSetChange
OnDirty
OnFilter

Only OnCurrent is triggered. But of course that event is also triggered
every time the data cursor is moved to an other record. It would be odd to
reconnect the recordset on that event.

Anyway when I do try to relink the recordset of the form on the OnCurrent
event, I get a system error: my application is closed, I'm asked to send a
report to MS and a backup is generated!
 

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