Quantcast
Channel: dBforums – Everything on Databases, Design, Developers and Administrators
Viewing all articles
Browse latest Browse all 13329

Davg Function

$
0
0
Can anyone solve this problem ?

There are 2 tables(LMEPriceT & BookingT) and 1 form(BookingT) in my access' database.

LMEPriceT fields are as following (2 Fields)

LDate Price
1/10/12 7660.50
2/10/12 8500.00
3/10/12 7555.50

BookingT fields are as following (4 fields)

StartDate EndDate Term Price


BookingT form fields are as following (4 Fields

StartDate EndDate Term Price
1/10/12 3/10/12 Average 7905.33 (Result)

I need average price between startdate and enddate if the term is average.

i tried below Davg function but it did not work.

Private Sub Term_AfterUpdate()
If Term = "Average" Then
Price = DAvg("Price", "LMEPriceT", "LDate>=#" & StartDate & "#" And "DLdate<=#" & EndDate & "#")
End If
End Sub


Please find attached screen shot.

Attached Images
File Type: png ScrnSht.png (276.1 KB)

Viewing all articles
Browse latest Browse all 13329

Trending Articles