Requery Macro

G

Guest

I have a macro on a subform control to requery a combo box in Access 2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID is the
combo box on the subform. The combo box row source is from the Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
• You tried to use the ApplyFilter action or method, but you didn't apply
the filter to a table, query, form, or report.
• You may have applied the filter to a form, but the form wasn't open in
Form or Datasheet view.
• You may have applied the filter to a report but didn't use the ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query, form, or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web site
that suggests replacing Requery action with RunCommand action and to set the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in Access 2000.

Please help.
 
K

Ken Snell [MVP]

Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control that
actually holds the subform object) on the main form? or is it the name of
the form that is being used as the subform? You must use the name of the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID
 
G

Guest

The form that I have opening in the macro is called frmAddProvider. It opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

Ken Snell said:
Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control that
actually holds the subform object) on the main form? or is it the name of
the form that is being used as the subform? You must use the name of the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


Karen said:
I have a macro on a subform control to requery a combo box in Access 2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID is
the
combo box on the subform. The combo box row source is from the Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you didn't apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't open in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query, form, or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web site
that suggests replacing Requery action with RunCommand action and to set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in Access
2000.

Please help.
 
K

Ken Snell [MVP]

ACCESS 2000 is a bit buggy with respect to some macro things for subform
contents... things may work in 2002 but not necessarily in 2000. It's
possible that you've run into one of those situations here.

When you get the "error message window" from the macro, on which step is
that error occurring?
--

Ken Snell
<MS ACCESS MVP>



Karen said:
The form that I have opening in the macro is called frmAddProvider. It
opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

Ken Snell said:
Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control that
actually holds the subform object) on the main form? or is it the name of
the form that is being used as the subform? You must use the name of the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


Karen said:
I have a macro on a subform control to requery a combo box in Access
2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID is
the
combo box on the subform. The combo box row source is from the
Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you didn't
apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't open
in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query, form,
or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web
site
that suggests replacing Requery action with RunCommand action and to
set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in Access
2000.

Please help.
 
G

Guest

I receive the error on the Requery step. That is when it says "You can't use
the ApplyFilter action on this window..."

Ken Snell said:
ACCESS 2000 is a bit buggy with respect to some macro things for subform
contents... things may work in 2002 but not necessarily in 2000. It's
possible that you've run into one of those situations here.

When you get the "error message window" from the macro, on which step is
that error occurring?
--

Ken Snell
<MS ACCESS MVP>



Karen said:
The form that I have opening in the macro is called frmAddProvider. It
opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

Ken Snell said:
Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control that
actually holds the subform object) on the main form? or is it the name of
the form that is being used as the subform? You must use the name of the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


I have a macro on a subform control to requery a combo box in Access
2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID is
the
combo box on the subform. The combo box row source is from the
Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you didn't
apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't open
in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query, form,
or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web
site
that suggests replacing Requery action with RunCommand action and to
set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in Access
2000.

Please help.
 
K

Ken Snell [MVP]

Your Requery step is not specifying the correct ProviderID control, most
likely. You note that the combo box ProviderID is located on the subform. Is
it named the same as the field to which it's bound? If yes, change the name
of the combo box to cboProviderID or something like that, and be sure to
change the appropriate macro steps accordingly.

It's been a while since I've done this, but I seem to recall that you'll
need to set focus onto the control in the subform, and then requery it. I do
recall that sometimes I have had problems with requerying a control in a
subform.

Before the Requery steps, insert two SetFocus steps: one to set focus to the
subform control, the second to set focus onto the combo box in the subform.
Then do the requery. Then put focus back where you want it to be as the step
after the Requery.

--

Ken Snell
<MS ACCESS MVP>


Karen said:
I receive the error on the Requery step. That is when it says "You can't
use
the ApplyFilter action on this window..."

Ken Snell said:
ACCESS 2000 is a bit buggy with respect to some macro things for subform
contents... things may work in 2002 but not necessarily in 2000. It's
possible that you've run into one of those situations here.

When you get the "error message window" from the macro, on which step is
that error occurring?
--

Ken Snell
<MS ACCESS MVP>



Karen said:
The form that I have opening in the macro is called frmAddProvider. It
opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

:

Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control
that
actually holds the subform object) on the main form? or is it the name
of
the form that is being used as the subform? You must use the name of
the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


I have a macro on a subform control to requery a combo box in Access
2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID
is
the
combo box on the subform. The combo box row source is from the
Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you didn't
apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't
open
in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query,
form,
or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web
site
that suggests replacing Requery action with RunCommand action and to
set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in
Access
2000.

Please help.
 
G

Guest

I do not see SetFocus on the Actions drop down for the macro. Would it be
called something else?

Ken Snell said:
Your Requery step is not specifying the correct ProviderID control, most
likely. You note that the combo box ProviderID is located on the subform. Is
it named the same as the field to which it's bound? If yes, change the name
of the combo box to cboProviderID or something like that, and be sure to
change the appropriate macro steps accordingly.

It's been a while since I've done this, but I seem to recall that you'll
need to set focus onto the control in the subform, and then requery it. I do
recall that sometimes I have had problems with requerying a control in a
subform.

Before the Requery steps, insert two SetFocus steps: one to set focus to the
subform control, the second to set focus onto the combo box in the subform.
Then do the requery. Then put focus back where you want it to be as the step
after the Requery.

--

Ken Snell
<MS ACCESS MVP>


Karen said:
I receive the error on the Requery step. That is when it says "You can't
use
the ApplyFilter action on this window..."

Ken Snell said:
ACCESS 2000 is a bit buggy with respect to some macro things for subform
contents... things may work in 2002 but not necessarily in 2000. It's
possible that you've run into one of those situations here.

When you get the "error message window" from the macro, on which step is
that error occurring?
--

Ken Snell
<MS ACCESS MVP>



The form that I have opening in the macro is called frmAddProvider. It
opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

:

Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control
that
actually holds the subform object) on the main form? or is it the name
of
the form that is being used as the subform? You must use the name of
the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


I have a macro on a subform control to requery a combo box in Access
2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item: [Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform. ProviderID
is
the
combo box on the subform. The combo box row source is from the
Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you didn't
apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't
open
in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query,
form,
or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base web
site
that suggests replacing Requery action with RunCommand action and to
set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in
Access
2000.

Please help.
 
K

Ken Snell [MVP]

Yes, sorry.... GoToControl

--

Ken Snell
<MS ACCESS MVP>

Karen said:
I do not see SetFocus on the Actions drop down for the macro. Would it be
called something else?

Ken Snell said:
Your Requery step is not specifying the correct ProviderID control, most
likely. You note that the combo box ProviderID is located on the subform.
Is
it named the same as the field to which it's bound? If yes, change the
name
of the combo box to cboProviderID or something like that, and be sure to
change the appropriate macro steps accordingly.

It's been a while since I've done this, but I seem to recall that you'll
need to set focus onto the control in the subform, and then requery it. I
do
recall that sometimes I have had problems with requerying a control in a
subform.

Before the Requery steps, insert two SetFocus steps: one to set focus to
the
subform control, the second to set focus onto the combo box in the
subform.
Then do the requery. Then put focus back where you want it to be as the
step
after the Requery.

--

Ken Snell
<MS ACCESS MVP>


Karen said:
I receive the error on the Requery step. That is when it says "You
can't
use
the ApplyFilter action on this window..."

:

ACCESS 2000 is a bit buggy with respect to some macro things for
subform
contents... things may work in 2002 but not necessarily in 2000. It's
possible that you've run into one of those situations here.

When you get the "error message window" from the macro, on which step
is
that error occurring?
--

Ken Snell
<MS ACCESS MVP>



The form that I have opening in the macro is called frmAddProvider.
It
opens
as a dialog. The user then adds the provider then closes the form.

The subform control is called frmProvider on the form frmIntake.

I have this macro attached to the double click event for the combo
box
called ProviderID.

I don't understand why this works in Access 2002 and not in 2000.

Thanks for any help you can provide.

:

Are you opening the form in dialog mode? or normal mode?

Is frmProvider the name of the actual subform control (the control
that
actually holds the subform object) on the main form? or is it the
name
of
the form that is being used as the subform? You must use the name
of
the
subform control:
Forms!frmIntake!NameOfSubformControl!ProviderID

--

Ken Snell
<MS ACCESS MVP>


I have a macro on a subform control to requery a combo box in
Access
2000

MsgBox Provider is not on list. Please Add.
OpenForm Opens a form to add provider to the provider table
SetValue Item:
[Forms]![frmIntake]![frmProvider]![ProviderId]
Expression: 0
Requery ProviderID

frmIntake is the main form. frmProvider is the subform.
ProviderID
is
the
combo box on the subform. The combo box row source is from the
Provider
table.

When the macro runs, I receive the following error:

You can't use the ApplyFilter action on this window.
. You tried to use the ApplyFilter action or method, but you
didn't
apply
the filter to a table, query, form, or report.
. You may have applied the filter to a form, but the form wasn't
open
in
Form or Datasheet view.
. You may have applied the filter to a report but didn't use the
ApplyFilter
action in a macro specified by the OnOpen property setting.
Use the SelectObject action or method to select the table, query,
form,
or
report before applying the filter.

I reviewed an article on Microsoft Office Access Knowledge Base
web
site
that suggests replacing Requery action with RunCommand action and
to
set
the
action argument set to Run.

This did not work.

This exact same macro works in Access 2002. It does not work in
Access
2000.

Please help.
 

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