Refresh a subform

  • Thread starter Thread starter Robert_DubYa
  • Start date Start date
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
 
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.
 
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/
__________________________________________
 
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!
 
Dirk,

Thanks you much this worked. Just was curious, because twice I have posted on Microsoft office message board site and the same post is posted on this site. I learned this by just doing a simple search via google after posting my message. I do not see your reply on the MS. Would you know why? Is this site mirroring the MS site but does not update the MS site? Just curious.

Thanks again for solution!
 
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.
 
Back
Top