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.