I'm working on an old vb6/access2003 app which is used to handle orders, bills of materials and that sort of things. I'm thinking about creating a form that I call every time the users needs to search for something. This should work like these:

  • Click on the field to complete, let's say name of a buyer
  • Open new form, search for the client and click on it
  • Return the name of the buyer to the previous form (probably the header of the order)

So, I would need to pass to the new form something that identify the type of search I have to do (so what access table to open) and return some values.

Is my idea correct or there something better? I would like to use only one form for all the searches, now the app works with a lot of msflexgrid for every form.

1 Answer 1


In a full object oriented language, one could apply the strategy pattern here. The idea is to have a base class SearchStrategy and for each kind of search a derived child class. The objects of this class should provide all meta data ("which table / columns to search for", "which parameters to enter from the user for this search"), or specific search methods. Then, one would pass the specific SearchStrategy object into the generic search form, and the form uses the strategy to do the search.

Though VB6 is not a full OO language like VB.NET, it provides indeed enough polymorphism capabilities to implement that pattern. See here or here, for example.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.