Run-time error '3075'; Syntax error in date epression (1 Viewer)

safeerbinsalih

Registered User.
Local time
Today, 19:10
Joined
Dec 30, 2015
Messages
26
Hi,

I've got syntax error in date expression in an SQL command

Dim db As Database
Dim rs As Recordset
Dim temp3, As Date
Dim temp1 As Long

Set db = CurrentDb()
Set rs = db.OpenRecordset("tblSale_order")

temp1 = Me.MID
temp3 = Me.txtexpecteddeliverydate

strSQL = "UPDATE [tblSale_order] SET [Expected_delivery_date] = #" & Format(temp3, dd - mm - yyyy) & "# WHERE [ID] = " & temp1 & ";"
db.Execute strSQL, dbFailOnError
MsgBox "Follow up details updated successfully", vbInformation, Message

Set rs = Nothing
Set db = Nothing

The code highlighted in red is throwing an error. Any help is highly appreciated
 

safeerbinsalih

Registered User.
Local time
Today, 19:10
Joined
Dec 30, 2015
Messages
26
Thanks man. It worked perfectly. Allen's method is really useful .Thanks for the tip
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 06:40
Joined
Aug 30, 2003
Messages
36,131
Happy to help!
 

Users who are viewing this thread

Top Bottom