comparing fields in multiple records, and then doing calculations

G

Guest

Hi everyone! I've been doing a lot of work lately in MS XLS, but I need to
move a custom fuction I wrote in VBA from XLS to Access. I'm still trying to
learn the inner workings of Access. What I need to do is compare fields and
if the fields meet certain criteria I then need to do calculations on them.

The fields contain an ID (inserted by Access), then a work order number
(there may be several records with the same work order number, but with
different events logged), there are several time-stamp fields which I do
calculations on providing certain events happen (which is documented in the
records).

I guess what I'm trying to say, is I have a work log of service calls that I
need to make sure were handled within a specific amount of time, excluding
certain events and only counting certain events.

If anyone can point in the right direction for documentation on working with
multiple records and comparing them, it would be much appreciated.

Thank you,
Mike
 
G

Guest

Without knowing all the particulars, I can only provide a suggestion. If you
are looking to find records in a table that need calculations based on
certain criteria, I would suggest a query. If you are going to be making
changes to the values in the fields, then it would most likely need to be an
Update query.
To do this, what you need to do is determine the criteria on which records
should be selected. You then need to write criteria into the query so that
it will affect only the records you want. In the query builder, there is a
row called Update To:
This row populates a row in the table with the value entered. That value
can be a hard coded value, a field from a related table, or can accept either
Access functions or user defined functions.
So, if you need to do a calculation on a field, you would write a VBA
function that performs the calculation and returns the results you want
stored in the field. You would pass it a value or values it would need to
perform the calculation.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top