1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
| Public Function GetMarginCLITRESODay(dateJour As Date) As Double
Dim requete As String, reponse As Recordset
'ouverture de la base de données
Set dbClio = OpenDatabase(databaseChemin)
requete = "SELECT sum(c.eur)+sum(c.jpy)/t.jpy + sum(c.usd)/t.usd + sum(c.cad)/t.cad + sum(c.nok)/t.nok + sum(c.aud)/t.aud + sum(c.dkk)/t.dkk + sum(c.gbp)/t.gbp AS totalCliTreso" _
& " FROM clitreso c, tauxchangedujour t where c.opening_date = #" & Format(dateJour, "mm/dd/yyyy") & "# GROUP BY t.jpy, t.usd, t.cad, t.nok, t.aud, t.dkk, t.gbp"
Set reponse = dbClio.OpenRecordset(requete)
If IsNull(reponse.Fields("totalCliTreso")) Then
GetMarginCLITRESODay = 0
Else
'Range("m1").Value = requete
GetMarginCLITRESODay = reponse.Fields("totalCliTreso").Value
End If
reponse.Close
dbClio.Close
End Function |