Hi All,
i am trying to run a update code from vba through adodb connection my Db is .MDB,
while runnign the update query i am getting "syntax error in update statement" error please help
As i am where i did it worng
my code so far
Code:
Private Sub save_btn_Click()
endtime = Format(Now(), "HH:MM:SS")
dat = Format(Now(), "DD/MM/YYYY")
num = Me.unique_text.Text
str1 = "update [Tab] set Territory ='" & Me.com_ter.Value & "',Tower = '" & Me.com_tow.Value & "',Activity ='" & Me.com_activity.Value & "',Sub_Activity ='" & Me.com_subactivity.Value & "',Processor_Name = '" & Me.com_processor.Value & "',Start_Time ='" & starttime & "',Received_Date=#" & Me.received_text.Text & "#,Due_Date =#" & Me.due_text.Text & "#,Processed_Date=#" & Me.processed_text.Text & "#,Subject='" & Me.subject_text.Text & "',Comments='" & Me.comments_text.Text & "',Action='" & Me.com_status.Value & "',Reason ='" & Me.reason_text.Text & "',End_Time='" & endtime & "',Status_Date=#" & dat & "# where tab.Id = " & num
Me.open_connection_product
con.Execute str1
Module1.close_connection
End Sub
Public Sub open_connection_product()
Set con = New ADODB.Connection
Set rec = New ADODB.Recordset
path = Sheets("PRG").Range("A65536").Value
constring = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & path & ";Jet OLEDB:Database Password=pass"
If con.State = 0 Then
con.Open constring
End If
End Sub
Bookmarks