J
John Moore
Guest
Re Access 2000.
Can someone please suggest how I can use DLookup to lookup a date (MarketDate) and return a price (CashPrice) relevant to that date. The code below works for date from 13th to 31st but not dates below this. Date format required is dd/mm/yy. The else works.
The code is below
If [PriceType] = "Cash" Then
ZZZ = "[MarketDate]= #" & Forms![frmTable2]!PurchaseDate & "#"
Price = DLookup("[CashPrice]", "tblCashPrice", ZZZ)
Else
Price = DLookup("[price]", "table1", "[contractno]=" & Forms![frmTable2]!ContractNo)
End If
Can someone please suggest how I can use DLookup to lookup a date (MarketDate) and return a price (CashPrice) relevant to that date. The code below works for date from 13th to 31st but not dates below this. Date format required is dd/mm/yy. The else works.
The code is below
If [PriceType] = "Cash" Then
ZZZ = "[MarketDate]= #" & Forms![frmTable2]!PurchaseDate & "#"
Price = DLookup("[CashPrice]", "tblCashPrice", ZZZ)
Else
Price = DLookup("[price]", "table1", "[contractno]=" & Forms![frmTable2]!ContractNo)
End If