Updating/Inserting records from Excel to Access table RUN TIME ERROR 3077 Syntax Error

Zee110

New Member
Joined
May 29, 2013
Messages
3
Hi Guys,

Please please please can somebody help me?! Seen some pretty good responses to issues on here so thought to give this a try. So I basically have a macro button that updates a few tables in Access from a Spreadsheet in Excel. There are several sheets but just one sheet seems to be temperamental. I need the code to work so that it adds new records and updates old records. The code that I have is:

Sub Update_Epic_Iteration_Assignment(db As DAO.Database)
'
' Update EPIC_ITERATION_ASSIGNMENT table in i-log database from EPIC_ITERATION_ASSIGNMENT sheet
'
Dim ws As Worksheet
Dim rs As DAO.Recordset
'Select source spreadsheet
Set ws = ActiveWorkbook.Sheets("EPIC_ITERATION_ASSIGNMENT")
'loop through entries
i = 3
While (ws.Cells(i, 1).value <> "")
If rs Is Nothing Then
Set rs = db.OpenRecordset("EPIC_ITERATION_ASSIGNMENT", dbOpenDynaset)
End If
rs.FindFirst ("Epic_Title=" & ws.Cells(i, 1).value)
If Not rs.NoMatch Then 'Record exists
With rs
.Edit
![Iteration_Assignment_Content] = ws.Cells(i, 2).value
![Iteration_id] = ws.Cells(i, 3).value
'Update Record into Database
.Update
End With
Else
With rs
.AddNew
![Epic_Title] = ws.Cells(i, 1).value
![Iteration_Assignment_Content] = ws.Cells(i, 2).value
![Iteration_id] = ws.Cells(i, 3).value
'Insert Record into Database
.Update
End With
End If
i = i + 1
Wend
'Close resultset
rs.Close
Set rs = Nothing
'
End Sub

The text in Bold is what is highlighted when I debug after getting the error "Run-time Error 3077 Syntax Error..." The weird thing is, I have the same code which works for the other sheets but not this work sheet.
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Forum statistics

Threads
1,223,275
Messages
6,171,123
Members
452,381
Latest member
Nova88

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top