Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

A2K Subform Requery

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
CJ - 08 Dec 2005 17:27 GMT
Hi Groupies.

In A2K3, I have the following code that works fine:

   Dim stDocName As String
   stDocName = "frmDriversSwampersLabourers"

   Visible = False

   DoCmd.SelectObject acForm, stDocName
   DoCmd.Requery
   DoCmd.Maximize

This code is on a command button that hides a pop up form after user input.

The problem is with the requery when I convert this code to A2K.

The parent form is frmDriversSwampersLabourers, the subform is
frmSubDriversSwampersLabourers. In A2K when I run the above code I receive
an error that says "You can't use the ApplyFilter action on this window". I
think it is because it is trying to requery the parent, not the sub.

So, I changed my code to the following:

   Dim stDocName As String
   stDocName = "frmDriversSwampersLabourers"

   Visible = False

   DoCmd.SelectObject acForm, stDocName
   DoCmd.Maximize

   stDocName = "frmSubDriversSwampersLabourers"
   DoCmd.SelectObject acForm, stDocName
   DoCmd.Requery

However, now I receive the message "The object
'frmSubDriversSwampersLabourers' isn't open."

I must have the subform requeried because the input on the pop up form
controls the sub.

Any suggestions??
Thanks
CJ
Marshall Barton - 08 Dec 2005 23:15 GMT
>In A2K3, I have the following code that works fine:
>
[quoted text clipped - 15 lines]
>an error that says "You can't use the ApplyFilter action on this window". I
>think it is because it is trying to requery the parent, not the sub.
[snip]
>I must have the subform requeried because the input on the pop up form
>controls the sub.

You should stay away from DoCmd when there is another way to
something.

In this case, you can requery the subform by using:

Forms!frmDriversSwampersLabourers.frmSubDriversSwampersLabourers.Form.Requery

No need for any of that other gobbledygook.

Signature

Marsh
MVP [MS Access]

CJ - 09 Dec 2005 05:20 GMT
Alrighty then.

Thanks Marshall
>>In A2K3, I have the following code that works fine:
>>
[quoted text clipped - 29 lines]
>
> No need for any of that other gobbledygook.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.