returned value poblem in sql update query

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have the following code in the after update event of form
[F_FicheContrat] :
If Me!DateFin < Date = False Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Interimaire'," _
& "TypeContrat = 'EF'," _
& "Datedispo = " & Me!DateFin & " WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
ElseIf Me!DateFin < Date = True Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Candidat'," _
& "TypeContrat = 'Aucun'," _
& "DateDispo = '' WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
End If
Everything works fine except that the " & Me!DateFin & " keeps returning
"30-Déc-1899". I think it's a system date problem but I don't know how to
fix it.
Any help would be greatly appreciated !
Thanks in advance
Access 2002
 
It's not a format problem: the value contained in Me!DateFin is a date
that should be copied to [DateDispo] . And whatever the date, the returned
value is always the same "30-dec-1899"

Newbie said:
Try formating it as format$(Me!DateFin, "mm/dd/yyyy")

Frankie said:
I have the following code in the after update event of form
[F_FicheContrat] :
If Me!DateFin < Date = False Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Interimaire'," _
& "TypeContrat = 'EF'," _
& "Datedispo = " & Me!DateFin & " WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
ElseIf Me!DateFin < Date = True Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Candidat'," _
& "TypeContrat = 'Aucun'," _
& "DateDispo = '' WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
End If
Everything works fine except that the " & Me!DateFin & " keeps returning
"30-Déc-1899". I think it's a system date problem but I don't know how to
fix it.
Any help would be greatly appreciated !
Thanks in advance
Access 2002
 
Use #! Its the date delimiter.
like - & "Datedispo = #" & Me!DateFin & "# WHERE IDInterimaire = " _

HTH
Martin J

Frankie said:
It's not a format problem: the value contained in Me!DateFin is a date
that should be copied to [DateDispo] . And whatever the date, the returned
value is always the same "30-dec-1899"

Newbie said:
Try formating it as format$(Me!DateFin, "mm/dd/yyyy")

Frankie said:
I have the following code in the after update event of form
[F_FicheContrat] :
If Me!DateFin < Date = False Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Interimaire'," _
& "TypeContrat = 'EF'," _
& "Datedispo = " & Me!DateFin & " WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
ElseIf Me!DateFin < Date = True Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Candidat'," _
& "TypeContrat = 'Aucun'," _
& "DateDispo = '' WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
End If
Everything works fine except that the " & Me!DateFin & " keeps returning
"30-Déc-1899". I think it's a system date problem but I don't know how to
fix it.
Any help would be greatly appreciated !
Thanks in advance
Access 2002
 
Thanks a lot !!
Frankie

Martin J said:
Use #! Its the date delimiter.
like - & "Datedispo = #" & Me!DateFin & "# WHERE IDInterimaire = " _

HTH
Martin J

Frankie said:
It's not a format problem: the value contained in Me!DateFin is a date
that should be copied to [DateDispo] . And whatever the date, the returned
value is always the same "30-dec-1899"

Newbie said:
Try formating it as format$(Me!DateFin, "mm/dd/yyyy")

I have the following code in the after update event of form
[F_FicheContrat] :
If Me!DateFin < Date = False Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Interimaire'," _
& "TypeContrat = 'EF'," _
& "Datedispo = " & Me!DateFin & " WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
ElseIf Me!DateFin < Date = True Then
CurrentDb.Execute "UPDATE T_Interimaires SET " _
& "Statut = 'Candidat'," _
& "TypeContrat = 'Aucun'," _
& "DateDispo = '' WHERE IDInterimaire = " _
& Me!IDInterimaire, dbFailOnError
End If
Everything works fine except that the " & Me!DateFin & " keeps returning
"30-Déc-1899". I think it's a system date problem but I don't know how to
fix it.
Any help would be greatly appreciated !
Thanks in advance
Access 2002
 
Back
Top