Tracker
HOME    TRACKER    MS ACCESS
 SuperbHosting.net & Arvixe.com have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for BigResource.com.

# How To Subtract Previous Record From Record

## I have a Motorhome which I want to check it's Fuel Economy, seems simple! I record the odomiter readingwhen I fill up with petrol and the amount of petrol pumped in to fill tank and the cost I have done it in Excel 97 but I would like to convert to an Access 97 Database. The purpose is to open an Access Form, add a record with Three Fields, namely the odomiter reading, Amount of Fuel pumped into tank, and Cost. I would then like Access to subtract the previous record's odomiter reading from the new odomiter reading to obtain the distance traveled since last fill and using this number and the other 2 fields I can calculate my fuel economy I tried to attached the Excel (97) spreadsheet for your information but it was too large for this forum The calculations are based on Australian Dollars, LPGas and Litres but it would make no differance if it were Gallons, US Dollars etc. I would very much appriciate a note to tell me if anyone is able to assist me with this problem. Thank You Paul Leaver Glenview Queensland Australia rpleaver@bigpond.net.au

Related Messages:
Dynamically Update Field Of A Current Record Based On Previous Record
I need a way to dynamically store a particular value in "field_2" of the CURRENT record depending on whether or not the value of "field_1" of the CURRENT record is identical to the value of "field_1" of the PREVIOUS record within the same table. The table is sorted on "field_1".

So, if the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is also "ABC", then store a value of "PPP" in "field_2" of the current record. IF on the other hand, the value of "field_1" in the CURRENT record is "ABC" and the value of "field_1" in the PREVIOUS record is "XYZ", then store a value of "WWW" in "field_2" of the current record.

I have a report that will use these results to count only the number of records that have a "WWW" in "field_2".

Is this doable, maybe in a query somehow?

I should add that whatever the solution, it needs to be compatible with Access 2000.

Refer To Previous Record In Current Record Query
In my query, i want to automatically display the value of another field from the previous record in a field in my current record. i.e.

Name Value Previous
Record 1 1
Record 2 2 1
Record 3 7 2
Record 4 1 7

Is it possible to create some kind of simple expression to refer to data in another record?

Cheers,
Ben

Subtract Previous Value From Next Value
:confused: Need help building a query that will subtract the previous value from the next value at each change in date

Date Tier 1
1/6/2006 4.22
1/13/2006 4.27
1/20/2006 4.27
1/27/2006 4.314
2/3/2006 4.314

for example, 4.22-4.27 = -0.05

Previous Record Value
Is there a way I can grab the previous record's value without using dlookup? I am trying to create a running total in a datasheet view. e.g.

Date Credit Debit Run. Tot.
6/1/06 \$25 \$0 \$25
6/4/06 \$30 \$0 \$55
6/9/06 \$0 \$50 \$5

I could do it by using an autonumber but the data is sorted by date and not by the order in which it was entered. Suggestions? :o

Previous Record
I have an inventory report that I am given among the fields are
Item, Ship Date, Signed Quantity, Filled-Recvd, On Hand
I am given an initial amount in the onhand field but the fields below that for that item are blank.
What I would like to do is [Signed Quantity] - [Filled-Recvd] and then add that to the On Hand from the previous record and place it in the on hand field..

If it were in excel I would say G2 – H2 + I1
G = Signed Quantity
H = Filled-Recvd
I = On Hand
TIA!
Scott

Previous Record As Default Value?
Is it possible for me to specify the default value in a table as what was inputed in the previous record?

Using Data From Previous Record
I'm a novice with Access but I thought I would use Access rather than Excel to record fuel use for our vehicles because the reporting functions should be more powerful.

I have set up a table where I input date, vehicle, member of staff, mileage of the vehicle and the cumulative reading from the fuel tank meter. I thought it should be simple enough to calculate the fuel used each fill by taking the meter reading away from the reading on the previous record, but I cannot find a way of getting Access to do this.

I am missing something obvious or not?

Thanks,

Henry

Default From Previous Record
Hi
Im wanting to set a default text from a previous record.
I have a fields that has Start location and Finish location,
Im wanting to set a defaulf so that the Finish location from the previous record is defaulted to the Start location of the next.
Is this possible????

How To Calculate The Previous Age Of A Record
:confused: I am trying write a select query to find the past age of the records based on a dated field "consigned date" and select only those records over 10 days old. I would like the user to input the date in time that will be used for the calculation reference. When I try this Access tells me the function is too complex. The query works when I change the user selected date with "date()" but this only give me the current age of the record not the age it was at a previous date. I would like to sum all record older than 10 days old from a user inputted date. Can someone please help I have exhausted my Access capabilities.

My code looks like below:

Records over 10 days: Sum(IIf([user input date]-[Consigned Date]>=10,1,0))

This one give me the current age.
Records over 10 days: Sum(IIf(date()-[Consigned Date]>=10,1,0))

Calculation On Previous Record
Hi, I'm wondering if anyone can help me with this query. I've had a look at some of the previous posts under previous record, but don't seem to be able to get to the bottom of it:

I have a set of data on employees who have all had one or more financial searches done on them and I want to return a field based on the previous record of that employee.

My data is as follows

Search ID----Employee ID-----Search Result

1-----001-----P
2-----002-----FCCJ
3-----002-----FCCB
4-----003-----P

I would like an extra field that looks at the previous row, decides whether or not the previous row is the same employee id and if it is returns "Same" and if it isn't returns "Different"

Thanks

Previous / Next Record Code
Ive added my own navigation buttons as I needed to add some code to them, but when a user gets to the first / last records & presses previous / next record, they get an error message 'cannot go to the specified record' and have to close & reopen the form.
It's prob. quite simple, but how do I get round this please?

Field Value Same As Previous Record
When I click my command button that says, "New Record", I want it to go to go to a new record and populate the field "Town" with the value in the previous record.

e.g. ClientID on last record is 150 and has Town="London". Click "New Record". New record created. Town field on ClientID 151 has Town="London".

How can I do this?

Thanks,

Dave

Previous Record Fields
Hi there, I'm trying to make a form which calculates the annual depreciation value of a property. I have tried using the PrevRecVal function and I even made the following query:

SELECT Last(PropertyDepreciation.[Total]) FROM PropertyDepreciation WHERE (((PropertyDepreciation.PropertyID)=(Forms!Propert yDepreciationSF!PropertyID)) And ((PropertyDepreciation.PDID)=((Forms!PropertyDepre ciationSF!PDID)-1)));

But still no luck. I made a text field called PreviousTotalValue to see what sort of information was being returned by the query and PrevRecVal and for both, #Name? is returned.
Any ideas fellas?
Bob

Data From Previous Record
I have still not solved the problem wich is doing my head in!!!
In the following DB I have the "frm1" wich the value of the first record for "Value1" is 10 when I pass to the second record Iwould like to show automatically the value 10 in the field "Value1" this for all the records untill I change toa new value so from then on it will show the new value.
I believe is the Dlookup function, but I have not find the way to make it work.
I must be thick but I need your help!!!!!
Thanks

Previous Record In Form
Is there way to have one or more of the fields in my form filled with information from the previous record? For example - If I am taking a gas pump reading at night and I want the form to subtract the start (last nights reading) from tonights reading to calculate total gallons sold for the day

or similarly I want to make a form to take starting cash, add sales, subtract payouts and deposits and come up with what ending cash should be... Do I have to put starting cash in manually each day or can I have it autofill from the previous record?

Moving To Previous Record
Can anyone tell me how do i move to the previous record in the database using asp. i have tried the following
Code:rs.moveprevrs.moveprevious
hint's will also help

Copy Some Data From Previous Record To Next
Hi
I need to copy some data from last record to next(New record), when a user clicks a button on a form. I don't want to copy all the data.

An example would be booking in items from an invoice:
Company would be the same
Invoice number would be the same
Product code would be different
quantity would be different

Hope this makes some sence, and i'm not being stupid:rolleyes:

Andy

Problem With Previous Record Button
Hi,

I have a form which a user enters some product details. some products have serial numbers, so if they are adding say 10 items they fill in all the details except the serial number. they then click a button which asks them to enter the serial number and does this with a do while loop untill the number of serial numbers entered = the quantaty of items they had entered previously.

My Problem - once the user has entered the last serial number if they click on the previous record button on the form another record is created with no serial number, any ideas how I can prevent this?

Andy:(

How might I go about taking the values fo certain fields in a previous record and place them in the same fields of the current record, using either a query or VBA?

I've seen something about being able to utilize previous record data but for the life of me I can't remember where I saw it!!

Any help is appreciated.

Use Previous Fields Record Details
Dear Guru's,
Happy New Year 2008.

:confused:

I have a task of implementing a fleet fuel consumption. I have made a form where user logs in previous odometer and current odometer reading. I have been challenged to make the system to automatically use previous odometer reading next refuelling. Please assist.

Joseph Njoroge

Moving Information From Previous Record
I need to be able to move 2 fields from the previous record to the next record. Does anyone know how to do this?

What I am doing is the following:

I have a table with 3 fields. I am using a form to enter the information. Two of the fields on the form will be information from the previous record. How can I bring that information forward to automatically be on the form and in the table?

Bring Forward Value In Previous Record
Hi,

I've created a table that has a date field and many locations field, to show when a location is taken up. In each location field, there's three list box options: empty, sign in, sign out. How can I make it so that when I choose sign in, the record will stay in "sign in" as I go down the field, until I choose "sign out"? I hope to display this in a form, so that I'll know when a location in occupied.

Any help will be greatly appreciated. :)

Niroth

Query Data From Previous Record
I currently have a form [frmE_PMSA] that has fields dtmDate, intHoursWorked, intHoursToGo, intWeeks, intHoursWeek.

On my form I would like to set up another field that is bound to the table that will upon clicking it, retrieve the data from the previous record [intHoursWeek] and run a calculation against the current records intHoursWorked.

Example:

dtmDate / intHoursWorked / intHoursToGo / intWeeks / intHoursWeek
05/23/05 / 400 / 10000 / 10 / 1000
05/30/05 / 500 / 9500 / 9 &nbsp;/ 1056

On my form, I would be showing the most recent data entry for the week of 05/30/05. What I would like to do is have a form field that upon clicking it, will calculate the percent efficiency for that weeks worked performed. In this case the calculation would be:

Efficiency = intHoursWorked(current Record "05/30/05") / intHoursWeek (Previous Record)
Efficiency = 500/1000

If someone can help with this I would appreciate it. Thanks!

How To Retrieve Field From Previous Record?
Okay, here's the query as simplified as possible:

Month - Days - PreviousMonth

Month and Days are pulled from a table called Calendar. How do I get PreviousMonth to display the Month from the previous record?

I was looking at a ranking formula, and it seems like it compares the field to the previous one, but I am not sure how to apply it to my situation. The ranking formula I was looking at:

(Select Count(*) from Data Where [ProductA1] > [Data1].[ProductA1];)+1

Thanks in advance for the help.

Copy Info From Previous Record
Suppose I have a customer database. Is there a way if I click on a button, it will create a new record and copy some of the info from the previous record?

Retrieve Previous Record's Date
Hi everyone,

I have a form with a date field on it. I would like the date field to automatically enter today's date, which it does now, but also I would like it to retrieve the previous record's date and if it is different from today's date, I want the form to use the previous date as the default value.

Thanks,
Chris

Recall - Previous Record Lookup
I've developed a multi user DB. When a user is keying in a record I want to be able to give them the ability to click on a button and the system automatically looks at two value from the previous record they keyed. There is a text box that contains their user ID so I can use this as a reference to look up their last record (I don't want them to take other users last records).

The fields are StartTime and EndTime. So I want the startTime and EndTime from their previous record to be dropped into the current record(without physically going backwards on screen).

Cheers,
Recall

Copying One Field From The Previous Record
Is there a way to make a button on a form that when it is pushed it copies one field from the previous record and then the rest is blank?