On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.
Private Sub Command1_Click() On Error GoTo Error_Handler Dim fdg As FileDialog, vrtSelectedItem As Variant Dim strSelectedFile As String Set fdg = Application.FileDialog(msoFileDialogFilePicker) With fdg .AllowMultiSelect = False .InitialView = msoFileDialogViewDetails If .Show = -1 Then For Each vrtSelectedItem In .SelectedItems strSelectedFile = vrtSelectedItem Next vrtSelectedItem Else End If Dim StrSQL As String StrSQL = "Delete * from Scrap;" DoCmd.SetWarnings False DoCmd.RunSQL StrSQL DoCmd.SetWarnings True DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12, "Scrap", strSelectedFile, True, , False End With Set fd = Nothing Exit_Procedure: Exit Sub Error_Handler: DisplayUnexpectedError Err.Number, Err.Description End Sub
Public Sub DisplayUnexpectedError(ErrorNumber As String, ErrorDescription As String) Select Case Err.Number Case 2522 MsgBox "You did not select an Excel file" End Select End Sub
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
|Using VBA and form selections to append an Access Table - And error 3134||4||14|
|Access date picker/Monday dates only||3||14|
|nested if statement in access with null values||2||4|
Join the community of 500,000 technology professionals and ask your questions.