C
Clemens
Hi,
I recieved a code to select an import excel sheet for my access table.
The following code is given, but there is a problem with the code.
At the line after: 'If .Show <> 0 Then' the problem is reported.
I placed xxx now to show where the compiler fails.
I entered the following code myself, but this can't be correct:
Me.AfterDelConfirm = .SelectedItems.Item(1)
I need to know what should be placed on the xxx. and 2nd: when I hit cancel
the code continues. So I also need to create a line "If Cancel is hit, then
stop code"
With Application.FileDialog(3)
.Title = "Select file"
.filters.Add "Excelfiles", "*.xls"
.FilterIndex = 0
.AllowMultiSelect = False
.InitialFileName = "c:\"
If .Show <> 0 Then
Me.xxx = .SelectedItems.Item(1)
DoCmd.RunSQL "DELETE * FROM Table"
DoCmd.TransferSpreadsheet acImport, , "Table", .SelectedItems.Item(1), True
End If
End With
I recieved a code to select an import excel sheet for my access table.
The following code is given, but there is a problem with the code.
At the line after: 'If .Show <> 0 Then' the problem is reported.
I placed xxx now to show where the compiler fails.
I entered the following code myself, but this can't be correct:
Me.AfterDelConfirm = .SelectedItems.Item(1)
I need to know what should be placed on the xxx. and 2nd: when I hit cancel
the code continues. So I also need to create a line "If Cancel is hit, then
stop code"
With Application.FileDialog(3)
.Title = "Select file"
.filters.Add "Excelfiles", "*.xls"
.FilterIndex = 0
.AllowMultiSelect = False
.InitialFileName = "c:\"
If .Show <> 0 Then
Me.xxx = .SelectedItems.Item(1)
DoCmd.RunSQL "DELETE * FROM Table"
DoCmd.TransferSpreadsheet acImport, , "Table", .SelectedItems.Item(1), True
End If
End With