Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Requery a Subform

Status
Not open for further replies.

rsheaffer

Technical User
Nov 9, 2000
4
US
I am having a problem performing a requery on subforms on a main form. The database is in Access 2000 and was just converted from Access 97. The requery on the subform "frmHardDriveLinkSubform" was working in Access 97, but does not in Access 2000. I put the requery (a macro) to happen on the Enter and Exit of the subform. The subform is constantly visible and would requery itself once you click one of the controls on the subform. I get the error, "You can't use the ApplyFilter action on this window." Nothing else has changed since the conversion - everything else is still intact and operational.

Please help with this in anyway that you can - it is getting very frustrating.

Thanks,
rsheaffer
 
try this:

requery main form
Me![SupplierandParts subform].Requery

requery a subform
Forms![frm-Safety Stock level]![Just Print These subform].Requery

Put either of these in the forms "On_Current" event


DougP, MCP
dposton@universal1.com

Ask me how Bar-codes can help you be more productive.
 
DougP,

This did not work. It slowed down the main form though, because it was running the main form query constantly. Do you know why the requery does not work the same as in Access 97? Do you have any other suggestions?
 
Hi,

I am having a similar problem with my Access 2K database and a subform requery. However, this was not converted from 97.

I am trying to put a requery subform action on the after insert event of a subform, but I get the same "You can't use the ApplyFilter action on this window." error.

there is no apply filter action in my macro or anything so it maybe it happens as part of the requery action?

I think it may have something to do with the different methods of requerying - as to whether the focus jumps back to the first record after the requery or not.

Or could this be a bug?

 
I have the following working - provided you have both main and subforms to allow fliters in their properties and you don't use the macros. I had the same problem and found that you cannot action the requery from the subform using macros.

you have to go to the action property then use the expression builder to insert code similar to this below.

Private Sub Frame34_Exit(Cancel As Integer)

Forms![Main Form].Controls![ControlAmt1].Requery

End Sub

Here I am actaully requerying the control [ControlAmt1] on the main form on Exit of the control [Frame34] which is on the subform.

As you are requerying a control on the subform and the action is on the subform I assume you will be able to use the Me! command but if not the above should work.
You may need something like:
Forms![Main Form].[Subform].Controls![ControlAmt1].Requery

Good luck
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top