If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Requery a subform from another subform
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 |
#2
|
|||
|
|||
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 "Debbie" wrote in message ... 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 |
#3
|
|||
|
|||
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 "Arvin Meyer" wrote: 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 "Debbie" wrote in message ... 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 |
#4
|
|||
|
|||
No the Tab control makes no difference in syntax, but it's possible that
"subform2" has a different name. -- Arvin Meyer, MCP, MVP Microsoft Access Free Access Downloads http://www.datastrat.com http://www.mvps.org/access "Debbie" wrote in message ... 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 "Arvin Meyer" wrote: 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 "Debbie" wrote in message ... 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 |
#5
|
|||
|
|||
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 "Arvin Meyer" wrote: No the Tab control makes no difference in syntax, but it's possible that "subform2" has a different name. -- Arvin Meyer, MCP, MVP Microsoft Access Free Access Downloads http://www.datastrat.com http://www.mvps.org/access "Debbie" wrote in message ... 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 "Arvin Meyer" wrote: 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 "Debbie" wrote in message ... 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 |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
requery tabs subform data if other tabs subform changes | Chris | General Discussion | 1 | April 20th, 2005 08:34 AM |
Requery in a SubForm | Marc | Using Forms | 1 | March 18th, 2005 08:43 PM |
Requery in a SubForm | Marc | Running & Setting Up Queries | 1 | March 18th, 2005 08:43 PM |
Subform Refresh Problem (but only with an unbound combo box control) | Barry Skidmore | Using Forms | 1 | December 21st, 2004 01:19 AM |