MS Access Forum / Macros / May 2006
How do I requery a combo box in a subform?
|
|
Thread rating:  |
Dodsey77 - 27 Apr 2006 09:28 GMT 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!
Steve Schapel - 27 Apr 2006 09:54 GMT 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.
 Signature Steve Schapel, Microsoft Access MVP
> Hello, > [quoted text clipped - 27 lines] > > Thanks in advance! Dodsey77 - 27 Apr 2006 10:58 GMT 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
> Dodsey, > [quoted text clipped - 39 lines] > > > > Thanks in advance! Dodsey77 - 27 Apr 2006 11:01 GMT 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,
> Dodsey, > [quoted text clipped - 39 lines] > > > > Thanks in advance! Dodsey77 - 27 Apr 2006 11:08 GMT 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
> Dodsey, > [quoted text clipped - 39 lines] > > > > Thanks in advance! Steve Schapel - 27 Apr 2006 20:05 GMT Helen,
Yes, the Enter event of the combobox is the simplest.
 Signature Steve Schapel, Microsoft Access MVP
> Hi Steve, > [quoted text clipped - 6 lines] > > Helen Dodsey77 - 04 May 2006 13:46 GMT 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!
> Helen, > [quoted text clipped - 10 lines] > > > > Helen Steve Schapel - 05 May 2006 01:40 GMT 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?
 Signature Steve Schapel, Microsoft Access MVP
> 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. Dodsey77 - 05 May 2006 13:13 GMT 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
> Dodsey, > [quoted text clipped - 9 lines] > > 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. Steve Schapel - 09 May 2006 10:31 GMT 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.
 Signature Steve Schapel, Microsoft Access MVP
> That's what I am wondering! > [quoted text clipped - 5 lines] > > Thanks again
|
|
|