In a form, I am trying to add the current date to a textbox when a button is clicked on the form. I thought this was easy but I keep getting different errors.
Here is the code.
The textbox is bound to a table where the dates will be stored.
Here is the code.
Code:
Function Import_Credit()
Dim appExcel As Excel.Application
Dim wb As Excel.Workbook
Dim sh As Excel.Worksheet
Dim strValue As String
On Error GoTo ImportXLSheetsAsTables_Error
Set appExcel = CreateObject("Excel.Application")
Set wb = appExcel.Workbooks.Open("\\cdnbwdata1\cardmgmt\Card Management Database Project\CREDIT.xls")
For Each sh In wb.Sheets
Debug.Print sh.Name
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "" & sh.Name, "\\cdnbwdata1\cardmgmt\Card Management Database Project\CREDIT.xls", True, sh.Name & "!"
Next
wb.Close
appExcel.Quit
MsgBox "Import Complete!"
On Error GoTo 0
Exit Function
ImportXLSheetsAsTables_Error:
MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure ImportXLSheetsAsTables of Module Module9"
End Function
The textbox is bound to a table where the dates will be stored.