How do I requery a combo box in a subform?

G

Guest

Hello,

I hope you can help!

I am creating a database with details on Retro gaming systems.

I have a main form, called Systems, where everything to do with old Retro
Gaming systems is displayed for each System. From within this form, I have a
tab control, which has two tabs: Games and Accessories. Each displaying the
details of all games or accessories on that particular system by way of a sub
form.

The details of the games are Name, Region, Format, Date Released, Licensee,
Price and whether it is Rare.

My problem is that Region, Format and Licensee are Combo boxes, so that
their value is looked up from their associated table. However, I have a
command button beside the box for the user to press if they need to add an
item on the list.

When they do this, the relevant entry form is displayed, however, when that
is closed down, I cannot get the combo box to be refreshed with the new
information.

I have tried the Requery command, but cannot get it to reference the field
within the tab control and subform.

I don't use modules for any code, and have just been using Macros. Can
anyone help with this?

Thanks in advance!
 
S

Steve Schapel

Dodsey,

Requery is the applicable action in your macro. You didn't mention
which event you were trying to use to run the macro. Easiest option
would be on the Enter event of the combobox itself. Then, in the macro,
just put the name of the combobox, for example...
[Region]

By the way, as an aside, Name and Format are both Reserved Words in
Access, and as such should not really be used as the name of a field or
control or database object.
 
G

Guest

Thanks for your help, Steve.

I will change the names of those fields, to make sure that isn't causing the
problem.

The only one I've been trying to do so far, however, is Licensee.

The method I've been trying to use is Requery, and then putting the name of
the control. I get an error message saying something about not being apply to
apply the filter, and I have to press "halt". I think it's something to do
with it not recognising the field name, seen as it isn't actually on the
Systems form, but is on the Games subform within a tab control... Incidently,
I have tried running the macro from the Games form only, and it works with no
problems. It is only when it is from within the subform that I can't get it
to work.

Any help would be greatly appreciated :)

Helen

Steve Schapel said:
Dodsey,

Requery is the applicable action in your macro. You didn't mention
which event you were trying to use to run the macro. Easiest option
would be on the Enter event of the combobox itself. Then, in the macro,
just put the name of the combobox, for example...
[Region]

By the way, as an aside, Name and Format are both Reserved Words in
Access, and as such should not really be used as the name of a field or
control or database object.

--
Steve Schapel, Microsoft Access MVP

Hello,

I hope you can help!

I am creating a database with details on Retro gaming systems.

I have a main form, called Systems, where everything to do with old Retro
Gaming systems is displayed for each System. From within this form, I have a
tab control, which has two tabs: Games and Accessories. Each displaying the
details of all games or accessories on that particular system by way of a sub
form.

The details of the games are Name, Region, Format, Date Released, Licensee,
Price and whether it is Rare.

My problem is that Region, Format and Licensee are Combo boxes, so that
their value is looked up from their associated table. However, I have a
command button beside the box for the user to press if they need to add an
item on the list.

When they do this, the relevant entry form is displayed, however, when that
is closed down, I cannot get the combo box to be refreshed with the new
information.

I have tried the Requery command, but cannot get it to reference the field
within the tab control and subform.

I don't use modules for any code, and have just been using Macros. Can
anyone help with this?

Thanks in advance!
 
G

Guest

Sorry... I forgot to say.

I was running the event from the data entry form for a new Licensee: After
the licensee name was entered, I was then pressing a command button which
closed the data-entry form, and then was to update the combo box on the
Systems form.

Thanks again,

Steve Schapel said:
Dodsey,

Requery is the applicable action in your macro. You didn't mention
which event you were trying to use to run the macro. Easiest option
would be on the Enter event of the combobox itself. Then, in the macro,
just put the name of the combobox, for example...
[Region]

By the way, as an aside, Name and Format are both Reserved Words in
Access, and as such should not really be used as the name of a field or
control or database object.

--
Steve Schapel, Microsoft Access MVP

Hello,

I hope you can help!

I am creating a database with details on Retro gaming systems.

I have a main form, called Systems, where everything to do with old Retro
Gaming systems is displayed for each System. From within this form, I have a
tab control, which has two tabs: Games and Accessories. Each displaying the
details of all games or accessories on that particular system by way of a sub
form.

The details of the games are Name, Region, Format, Date Released, Licensee,
Price and whether it is Rare.

My problem is that Region, Format and Licensee are Combo boxes, so that
their value is looked up from their associated table. However, I have a
command button beside the box for the user to press if they need to add an
item on the list.

When they do this, the relevant entry form is displayed, however, when that
is closed down, I cannot get the combo box to be refreshed with the new
information.

I have tried the Requery command, but cannot get it to reference the field
within the tab control and subform.

I don't use modules for any code, and have just been using Macros. Can
anyone help with this?

Thanks in advance!
 
G

Guest

Hi Steve,

Having re-read your reply, I see that you are suggesting I run the requery
macro from the combo box itself, rather than how I was doing it.

I will give this a go, and let you know if I am still having problems.

Many thanks for your help,

Helen

Steve Schapel said:
Dodsey,

Requery is the applicable action in your macro. You didn't mention
which event you were trying to use to run the macro. Easiest option
would be on the Enter event of the combobox itself. Then, in the macro,
just put the name of the combobox, for example...
[Region]

By the way, as an aside, Name and Format are both Reserved Words in
Access, and as such should not really be used as the name of a field or
control or database object.

--
Steve Schapel, Microsoft Access MVP

Hello,

I hope you can help!

I am creating a database with details on Retro gaming systems.

I have a main form, called Systems, where everything to do with old Retro
Gaming systems is displayed for each System. From within this form, I have a
tab control, which has two tabs: Games and Accessories. Each displaying the
details of all games or accessories on that particular system by way of a sub
form.

The details of the games are Name, Region, Format, Date Released, Licensee,
Price and whether it is Rare.

My problem is that Region, Format and Licensee are Combo boxes, so that
their value is looked up from their associated table. However, I have a
command button beside the box for the user to press if they need to add an
item on the list.

When they do this, the relevant entry form is displayed, however, when that
is closed down, I cannot get the combo box to be refreshed with the new
information.

I have tried the Requery command, but cannot get it to reference the field
within the tab control and subform.

I don't use modules for any code, and have just been using Macros. Can
anyone help with this?

Thanks in advance!
 
G

Guest

Hello,

I am still having the same problem. It is fine if the combo box is on the
form, but when it is within a subform and within a tab control, I am getting
an error message telling me the ApplyFilter cannot be ran.

I hope someone can help!
 
S

Steve Schapel

Dodsey,

Being on a Tab control doesn't make any difference.

What is ApplyFilter all about? This does not seem to be related to your
original question. Is there an ApplyFilter action in your macro? If
so, what are the details?
 
G

Guest

That's what I am wondering!

All I have in my macro, is the requery, and yet that is the error message
that appears.

Is there any way you could just try it at your end. I'm sure it is something
to do with it being within a Subform...

Thanks again
 
S

Steve Schapel

Dodsey,

Ok, I can have a look at it, I can't think of any explanation. Please
zip your database file and sent it to steves at mvps dot org.
 

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