Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I make access report diffrences between rows in a table

Status
Not open for further replies.

MAC2505

Technical User
Jul 4, 2002
4
GB
I have a table called TachoDetails in it are the fields
RegID
Date
StartKM
FinishKM
What I want to do is generate a report that sorts the data by Reg which I can do easily what i need to do is get access to show the diffrence between the end FinishKM and Start KM Of next Record
Example
RegID Date StartKM FinishKM (Diffrence New Field)
1 12/02/03 12345 12350
1 12/02/03 12352 12355 2
1 13/02/03 12359 12377 4
Thanks for any help
 
One possible way to acheive this would be to add one module scoped variable (m_dblAmount) and within the Detail_Format event procedure a small amount of code that solves the problem.

Private m_dblAmount As Double

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)

'Place the Absolute Value of the difference between the
'the current value and the last saved (zero by default)
txtDiffQty.Value = Abs(txtQuantity.Value - m_dblAmount)
'Replace the saved value with the current value
m_dblAmount = txtQuantity.Value

End Sub

I hope this Helps.
 
Hi Blanch cant seem to get this to work but Im new to accsess
 
What version of Access are you using? I could send you a demo to learn from.
 
Blanch,
The best method is to post it to the web (maybe include the code in a post in this thread). That way, you'll help MAC2505 and possibly many others for years to come. Also, you won't be plague with 50,000 requests to send the sample to other people.
These forums are only truly helpful if the answers get posted in them. If the answers are given through personal emails, only one person gets helped.
 
Blanch can you E mail it to mcraig@7collins.freeserve.co.uk

thanks for all your help

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top