View Single Post
Old October 17th, 2005, 04:40 PM
Figgis Figgis is offline
Authorized User
Join Date: Oct 2005
Location: South Ockendon, Essex, United Kingdom.
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Figgis

Well it sort of goes like this. When the wife asks me to make a cup of tea there is a whole series of things I have to do. I fill the kettle with tap water, I get the cups ready, When the kettles boiled I poor the water etc. It would be a bit long winded for her to tell me how to do all that each time she wanted a drink so she just say's "get off ya butt and make a drink".

It works the same way. You have three reasonably complex calculations that you want to be carried out when a certain condition applies. i.e. When the buyer is Diana Grover you want to apply the calculations.

If you set the calculations up as a subroutine then you can call upon it when you want without having to rewrite it for each condition where you want it to apply. All you need to do is write a simple IIf statement to test the condition and if it meets your criterea then it runs the subroutine.

What I meant by the last part is that by hard coding a persons name into an application you make it very inflexible and store yourself up problems for later. Say six months down the road you want to apply the same conditions to Jon Williams. If you write it the way you intend to your going to have to break into your code and make the changes or write a whole new set of code. What I would do is set up a table with the list of names and a check box for when you wish to apply your calculations. I've done a similar thing with the database I'm curently working on. I have a claim form where the confirmation team can choose to have an investigation carried out. Then the stock control team will only see the records that have been requested for an investigation.

As I said I'm only just begining with Access and VBA myself and by no means am I an expert. What I have suggested is only the method I would use.