Changing the recordset of one form based on the recordset of another form

S

Scott Doyle

I've been trying to create a pop-up window that contains a form holding a
table of records. I have a second main form that is bound to this table as
well. I would like for the recordset of the mainform to change it's focus
when a record in the popup is selected.

I've found instructions for changing the recordsets accordingly when two
subforms are on a single form but none where two different forms are used.
I've tried something like this:

form popupform get focus

set mainform.recordset = _
popupform.recordset


But I get errors. This is not exactly how it was worded in the code, I'm
not on that PC at the moment, but you get the idea. I'm sure it's something
simple but I've just not found the right wording. As you can tell I'm not
much at VB code writing.

Any suggestions?

Thanks,

Scott
 
J

Jim Bunton

You can find and alter a Form's RecordSource and then requery it
e.g.

Forms!MyForm.Recordsource = [a valid sql statement]
Forms!MyFormForm.Requery

So when you select a record on one form you can use the onclick event to
generate a string
which is to be the Recordsource of another form then requery it
[you'll need to add some code to make sure that 'another Form' exists
or you'll get an error

Hope this helps
 

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