SQL update statement error

  • Thread starter George Papadopoulos
  • Start date
G

George Papadopoulos

I have written the code below :

Private Sub btnUpdate_Click()
Dim strUpdate As String
Dim strTest As String

On Error GoTo Err_btnUpdate

strUpdate = "Update EPISKEYH SET Kwdikos_texnikou = '" & Me.Kwdikos_texnikou
& "'" _
& ", Kwdikos_mhxanhmatos = '" & Me.Kwdikos_mhxanhmatos & "'" _
& ", Hmeromhnia = #" & Me.Hmeromhnia & "#" _
& ", Wra_enarjhs = #" & Me.Wra_enarjhs & "#" _
& ", Wra_lhjhs = #" & Me.Wra_lhjhs & "#" _
& ", Aitia_blabhs = " & Me.Aitia_blabhs _
& ", Katastash =" & Me.Katastash _
& ", Ek8esh_texnikou = '" & Me.Ek8esh_texnikou & "'" _
& " WHERE Kwdikos_episkeyhs = '" & Me.Kwdikos_episkeyhs & "';"

CurrentDb.Execute (strUpdate)
Exit Sub

Err_btnUpdate:
MsgBox Err.Description
End Sub

The statement CurrentDb.Execute(strUpdate) fails with a 'syntax error' error
message. The syntax error has been tracked to the fields Wra_enarjhs &
Wra_lhjhs.

Hmeromhnia is a date field.
Wra_enarjhs contains time. (defined as date/time)
Wra_lhjhs also contains time.
Ek8esh_texnikou is a memo field.
All other fields are strings.

Debug.Print strUpdate
Update EPISKEYH SET Kwdikos_texnikou = '3057', Kwdikos_mhxanhmatos = '4419',
Hmeromhnia = #28/4/2004#, Wra_enarjhs = #10:00:00 ?i#, Wra_lhjhs = #10:15:00
?i#, Aitia_blabhs = False, Katastash =True, Ek8esh_texnikou = '?aeaoiYia
ceaeonuaea. AioeeaoUooaoc.' WHERE Kwdikos_episkeyhs = '203';

This is the output of the strUpdate, after the execution of the assignment
statement and before execution of the CurrentDb.Execute statement.

Any suggestions?

thx, in advance


George Papadopoulos
 
M

Michel Walsh

Hi,


You have a ?i in a date constant: #10:00:00 ?i#, at two places.



Hoping it may help,
Vanderghast, Access MVP
 
G

George Papadopoulos

Could this have something to do with the fact that the time contains the am
or pm suffix?
 
M

Michel Walsh

Hi,


Very probable. I would try an explicit format: FORMAT( value,
"\#hh:nn:ss\#" )


Hoping it may help,
Vanderghast, Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top