P
Paul3rd
Hello, I'd like to use an append query in a On Click event to update my table
from
an Excel spreadsheet.
The table is named Air_Filters, and the spreadsheet resides on C: with full
permissions set for Everyone.
I'm using the following code for the query:
INSERT INTO [Air_Filters]
SELECT *
FROM [TEXT;HDR=YES;DATABASE=C:\].AirFilters.xls;
The following code for the button:
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim stDocName As String
Dim AFUP As Integer
stDocName = "AirFilters"
AFUP = MsgBox("Delete & Replace all air filters?", vbOKCancel, "Air
Filter Update")
If AFUP = 1 Then
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
Else
MsgBox ("Update Cancelled")
End If
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
The problem is that On Click I get the following error;
"Cannot update. Database or object is read-only."
Again my spreadsheet AirFilters.xls is not marked as read-only, and full
permissions are set for everyone.
Can anyone offer a suggestion?
Thanks in advance for any help.
Paul
from
an Excel spreadsheet.
The table is named Air_Filters, and the spreadsheet resides on C: with full
permissions set for Everyone.
I'm using the following code for the query:
INSERT INTO [Air_Filters]
SELECT *
FROM [TEXT;HDR=YES;DATABASE=C:\].AirFilters.xls;
The following code for the button:
Private Sub Command23_Click()
On Error GoTo Err_Command23_Click
Dim stDocName As String
Dim AFUP As Integer
stDocName = "AirFilters"
AFUP = MsgBox("Delete & Replace all air filters?", vbOKCancel, "Air
Filter Update")
If AFUP = 1 Then
DoCmd.SetWarnings False
DoCmd.OpenQuery stDocName, acNormal, acEdit
DoCmd.SetWarnings True
Else
MsgBox ("Update Cancelled")
End If
Exit_Command23_Click:
Exit Sub
Err_Command23_Click:
MsgBox Err.Description
Resume Exit_Command23_Click
End Sub
The problem is that On Click I get the following error;
"Cannot update. Database or object is read-only."
Again my spreadsheet AirFilters.xls is not marked as read-only, and full
permissions are set for everyone.
Can anyone offer a suggestion?
Thanks in advance for any help.
Paul