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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding totals from seperate records

Status
Not open for further replies.

billheath

Technical User
Mar 17, 2000
299
US
If this has been done before, please help me to find it.

I need to add the totals from the current form and the one just before it. Basically I need to average the 2 totals. The id field is auto numbered so it should be easy but so far I haven't got it to work.
 
Sorry.
I tried to use this expression:
Dim c As Currency
Dim fld As Single
fld = Me!ID - 1
'c = DLookup("stock_total", "St_Daily_Value", "[ID] = '" & fld_ & "'")

I was trying to use the current AutoId -1 to give the criteria for the table record to get the total from. (In other words, to compare the data from the previous record.
I have changed the criteria around several times. The current error is "Data Mismatch in the criteria statement.)

Thanks for answering.
 
What about this ?
c = DLookup("stock_total", "St_Daily_Value", "ID=" & fld)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top