Requery Multiple Forms after exiting a form

manix

Registered User.
Local time
Today, 20:59
Joined
Nov 29, 2006
Messages
100
HI All,

I have a small question. I have a form that can be opened from another form to add a record to a combo box. So if the use looks at the drop down list from the combo box and they cannot see the item they require, they can click a button and "add" the required item to the list.

In order for this to work correctly and update the list as soon as they exit the "add" form, I have the following code working on the On Exit:

Code:
Forms![frm_concern]![Supplier].Requery

Now this is fine if I only want to use the add form on the [frm_concern] form. However, I would like to make use of this form on other forms where the combo list appears. How do I do that? Sorry I am not up to speed totally on VB!

TIA
 
If I understand your question correctly, you have a form that you open from a command button, let's call this the "called form" and let's say the form which hosts the command button is called the "calling form".

At the moment this works fine because you have the calling form calling the called form and they both know what is expected.

However you want to use the called form from other forms Throughout your database.

To make this work the called form will need to know which form it was called from and to take action accordingly.

My first attempts at solving this problem were to pass the called forms name to the calling form, I actually passed it into a custom property, but you could just as well pass into the tag property.

Then you examine this forms name stored in either in the tag property or a custom property and use a case statement to take the required action.

I did it in the manner described above successfully for a few years, but I noticed other programmers did things slightly differently, basically the problem with this method is that you have code in the "called form" that you have to change whenever you want to call it from somewhere else. The ideal situation is to have the "called form" appear to your program as a self contained "black box" with a set of known inputs and outputs and actions.

What I am trying to say is I have progressed my programming experience from this point to where I have recently developed a system which utilizes a class you can see this working in the free calendar form which is downloadable from my web site here: http://msaccesshintsandtips.ning.com/profiles/blog/show?id=948619:BlogPost:301

Cheers Tony
 
Thanks Tony,

I will review it and see what I can do with it, looks good.

Thanks again.
 

Users who are viewing this thread

Back
Top Bottom