gigifarrow
asked on
Error 3113 Cannot Update "PercentagesFortBenningEMI'; field not updateable
I have code that imports data from Excel to a Access table. I have the same code for other tables to import and they work fine. when I click on the button to Import data I get this Message"Error 3113 Cannot Update "PercentagesFortBenningEMI '; field not updateable".
I checked the fields and they are the same. So I dont know what to check next. Any suggestions experts? Thank you for your time and help in advance!
I can import the data in by using the dab in Access for external data . Which seems like it shouldnt work if the import button is not working.
Below is the code.
DoCmd.SetWarnings False
Dim DailyReportmsgbox As String
DailyReportmsgbox = MsgBox("You are about to update data and delete Old Data .Do you want to continue?", vbInformation + vbYesNo, "Export Data")
If (DailyReportmsgbox = vbYes) Then
DoCmd.OpenQuery "qryDeleteFortBenningEMIOn ly"
DoCmd.OpenQuery "qryDeleteScopeUnitFortBen ningEMIOnl y"
MsgBox "Delete Records Successful!"
'Import new Data
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="tblScopeUnitFo rtBenningE MIOnly", FileName:="C:/ExportFolder /tblScopeU nitFortBen ningEMIOnl y.xlsx", HasFieldNames:=True
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="qryPercentageF ortBenning EMIOnly", FileName:="C:/ExportFolder /qryPercen tageFortBe nningEMIOn ly.xlsx", HasFieldNames:=True
MsgBox "Import Successful!"
ElseIf (DailyReportmsgbox = vbNo) Then
MsgBox "Action Aborted!"
Exit Sub
End If
'Delete old data from import
If Len(Dir("C:\ImportFolder\t blScopeUni tFortBenni ngEMIOnly. xlsx")) > 0 Then
Kill ("C:\ImportFolder\tblScope UnitFortBe nningEMIOn ly.xlsx")
If Len(Dir("C:\ImportFolder\q ryPercenta geFortBenn ingEMIOnly .xlsx")) > 0 Then
Kill ("C:\ImportFolder\qryPerce ntageFortB enningEMIO nly.xlsx")
MsgBox "C drive Deleted!"
End If
End If
End Sub
I checked the fields and they are the same. So I dont know what to check next. Any suggestions experts? Thank you for your time and help in advance!
I can import the data in by using the dab in Access for external data . Which seems like it shouldnt work if the import button is not working.
Below is the code.
DoCmd.SetWarnings False
Dim DailyReportmsgbox As String
DailyReportmsgbox = MsgBox("You are about to update data and delete Old Data .Do you want to continue?", vbInformation + vbYesNo, "Export Data")
If (DailyReportmsgbox = vbYes) Then
DoCmd.OpenQuery "qryDeleteFortBenningEMIOn
DoCmd.OpenQuery "qryDeleteScopeUnitFortBen
MsgBox "Delete Records Successful!"
'Import new Data
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="tblScopeUnitFo
DoCmd.TransferSpreadsheet transfertype:=acImport, tablename:="qryPercentageF
MsgBox "Import Successful!"
ElseIf (DailyReportmsgbox = vbNo) Then
MsgBox "Action Aborted!"
Exit Sub
End If
'Delete old data from import
If Len(Dir("C:\ImportFolder\t
Kill ("C:\ImportFolder\tblScope
If Len(Dir("C:\ImportFolder\q
Kill ("C:\ImportFolder\qryPerce
MsgBox "C drive Deleted!"
End If
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.