Requery a subform from another subform


G

Guest

Hello,
I have a main form (MainForm1). It contains 2
seperate subforms on it totally independent of one another (subform1) and
(subform2). Subform1 contains a list of selectable rows. Once the user
selects a row from subform1, they click on a button that adds it to the
underlying table on subform2. I would like the new rows to be displayed on
subform2. I have put the following statement in the button on subform1
where the user selects the row and I have put it in the AfterUpdate event on
subform1:
Forms!Mainform1!subform2.form.Requery

I've also used:
Forms!Mainform1!subform2.Requery

Still no requerying is happening. Can this be done and if so, what am I
doing wrong. I truly appreciate any input. Thanks,
Debbie
 
Ad

Advertisements

A

Arvin Meyer

Hi Debbie,

The first syntax:

Forms!Mainform1!subform2.form.Requery

is correct. It could be that the AfterUpdate of the form hasn't fired yet.
Stick a line below the requery line like:

MsgBox "Yep, I've fired"

and see if it pops up. You can also force a requery with a "bigger hammer"
just do something like:

Forms!Mainform1!subform2.form.Recordsource = "Select whatever ..."

and give it the same recordsource as the first one. Access will think you're
changing the recordsource and force a requery.
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
G

Guest

Arvin,
Thanks so much for your reply. I did try that and I got a message saying
"...can't find subform2..." Something then hit me that I never thought would
matter and that is that these subforms are within a tab control. Do I need
to reference the tab control and then the subform? I'm sorry I didn't
mention it earlier but I did not think it would make a difference. Thanks,
Debbie
 
Ad

Advertisements

G

Guest

Arvin,
Thank you again. I did get the syntax right but it is still not requerying.
I am going to do something different as I think the requerying is being done
but the inserted row is not available immediately. Even if I press F9, the
row doesn't always show on the first time pressing F9. A new problem to
research! Thanks again for your help.
Debbie
 

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