access calculation

Discuss all aspects of programming here.

Moderator: The Mod Squad

access calculation

Postby ~Rob » Sun Dec 04, 2005 11:46 am

I'm trying to add a fine calculator to a database. For example, if it is a week overdue the fine is £1. I tried using "date<[DateDue] = 1, but I don't know what field to put it into (validation, default value, etc)


Jocuri cu impuscaturi si alte genuri, pentru toate varstele doar pe acest link - distractie si amuzament garantat!
Black Belt 4th Degree
Black Belt 4th Degree
Posts: 4941
Joined: Sun Dec 28, 2003 8:26 pm
Location: Norwich, UK

Postby dgeffs » Mon Dec 05, 2005 5:40 am

Normally you would not put something like this into a database field property like validation or default value. The default value would calculate the fine once when the record was created but not after that. Since the fine would change on a weekly basis you need some sort of procedure to go through the database and calculate it for each record.

I would normally do this based on some sort of event like a button click or perhaps when a record is displayed on screen you could make the calculation. It could also be done in a query by using date()-[duedate] to give you the number of days and then dividing by 7 for the number of weeks and multiply by the fine.

There are numerous ways to do this but it really depends on how you are setting up and displaying the records and whether or not you are using forms or just a query to display the raw data.

I use Access as a development tool and create applications for end users. But other people use Access to interact with the data without using forms and perhaps building or changing queries on the fly. How you do this is determined by the methods you are using to display the data.

Brown Belt
Brown Belt
Posts: 327
Joined: Tue Jul 27, 2004 10:41 am
Location: Houston

Return to Programming

Who is online

Users browsing this forum: DotBot [Bot] and 0 guests