1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| Public Function F_Date(wDate As Variant) As String
'transforme une date pour ecriture dans la base de données
On Error GoTo erreur
If IsNull(wDate) Then 'date non renseignée
F_Date = "Null"
ElseIf IsDate(wDate) Then
If pTypeBD = "ACCESS" Then 'Access 97,2000
F_Date = "#" & Format(wDate, "yyyy/mm/dd hh:nn:ss") & "#"
ElseIf pTypeBD = "SQL-SERVER" Then 'SQL Server 7.0
F_Date = "Convert(DateTime,'" & Format(wDate, "dd/mm/yyyy hh:nn:ss") & "',103)"
Else 'Autre
F_Date = wDate
End If
Else 'erreur, pas de type date
F_Date = "Null"
End If
Exit Function
erreur:
'Ecriture dans le Journal d'événements
F_Date = "Null"
End Function |
Partager