Refresh a subform

R

Robert_DubYa

I have two subforms on one page. When I double click on an object from the
first subform I want it to move to the second subform. I can get it to work
fine with exception of refreshing the view of the second subform.

here is my current code:

Private Sub OrderNumb_DblClick(Cancel As Integer)

DoCmd.OpenReport "qryPartsListForReport"

Part_List_Printed = True 'this is checkbox in the subforms

DoCmd.Requery

frmPickPartssubformInprocess.Requery

End Sub

The last line of code does not work. Any help will be apperciated.

thanks,
Robert
 
D

Dirk Goldgar

Robert_DubYa said:
I have two subforms on one page. When I double click on an object from the
first subform I want it to move to the second subform. I can get it to
work
fine with exception of refreshing the view of the second subform.

here is my current code:

Private Sub OrderNumb_DblClick(Cancel As Integer)

DoCmd.OpenReport "qryPartsListForReport"

Part_List_Printed = True 'this is checkbox in the subforms

DoCmd.Requery

frmPickPartssubformInprocess.Requery

End Sub

The last line of code does not work. Any help will be apperciated.

thanks,
Robert


You need to reference the other subform through the parent form, and using
the name of the subform control on that parent form. That subform control
may or may not have the same name as the form object it displays, so you'll
have to check that. If the subform control *is* named
"frmPickPartssubformInprocess", then this should work:

Me.Parent!frmPickPartssubformInprocess.Requery

If "frmPickPartssubformInprocess" isn't the name of the subform control,
replace that string in the above line of code with the real name.

Incidentally, to requery the current subform I would use

Me.Requery

instead of
DoCmd.Requery

.... just to make sure that the correct object always gets requeried.
 
T

Tom Wickerath

Hi Robert,

You need to reference the name of the control that holds the subform. This
may or may not be the same name as the subform itself. Something like this:

NameOfSubformContainer.Form.Requery


Tom Wickerath
Microsoft Access MVP
http://www.accessmvp.com/TWickerath/
__________________________________________
 
R

Robert_DubYa

Tom,

I keep getting an "object required" error. I have tried the following:

frmPickPartssubformInprocess.Form.Requery
(this is NameOfMySubformObject.Form.Requery)

frmPickPartssubformInprocess.frmPickPartssubformInprocess.Requery
(this is NameOfMySubformObject.NameOfMySubform.Requery)

frmPickPartssubformInprocess.frmPickParts.Requery
(this is NameOfMySubformObject.NameOfMyForm.Requery)

I'm not sure I mentioned it, but my code is located in a double event of the
first subform. After I double click on the "Order Number" I want the second
subform to refresh.

thanks for your help!
 
D

Dirk Goldgar

Robert_DubYa said:
Tom,

I keep getting an "object required" error. I have tried the following:

frmPickPartssubformInprocess.Form.Requery
(this is NameOfMySubformObject.Form.Requery)

frmPickPartssubformInprocess.frmPickPartssubformInprocess.Requery
(this is NameOfMySubformObject.NameOfMySubform.Requery)

frmPickPartssubformInprocess.frmPickParts.Requery
(this is NameOfMySubformObject.NameOfMyForm.Requery)

I'm not sure I mentioned it, but my code is located in a double event of
the
first subform. After I double click on the "Order Number" I want the
second
subform to refresh.


I posted an earlier reply to the newsgroup, but it doesn't seem to have made
it to the web forum. This is what I said:

You need to reference the other subform through the parent form, and using
the name of the subform control on that parent form. That subform control
may or may not have the same name as the form object it displays, so you'll
have to check that. If the subform control *is* named
"frmPickPartssubformInprocess", then this should work:

Me.Parent!frmPickPartssubformInprocess.Requery

If "frmPickPartssubformInprocess" isn't the name of the subform control,
replace that string in the above line of code with the real name.

Incidentally, to requery the current subform I would use

Me.Requery

instead of
DoCmd.Requery

.... just to make sure that the correct object always gets requeried.
 

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