mike.molina
Registered User.
- Local time
- Today, 02:07
- Joined
- Jul 2, 2014
- Messages
- 12
Gurus,
I have an Access Database which imports data from an excel workbook located on C:\Drive. My problem is the excel workbook is not enabled so when the import occurs no data is imported into Access. If I manually enable the content on the excel workbook the import will work fine. Is there a VBA I can write that will locate the file, enable the content then import the data? below is what the VBA currently looks like:
PLEASE HELP

R/s,
Michael
I have an Access Database which imports data from an excel workbook located on C:\Drive. My problem is the excel workbook is not enabled so when the import occurs no data is imported into Access. If I manually enable the content on the excel workbook the import will work fine. Is there a VBA I can write that will locate the file, enable the content then import the data? below is what the VBA currently looks like:
Code:
'===============IMPORT SUBINVENTORY DATA=====================
Private Sub Command36_Click()
Dim filepath As String
filepath = "C:\UUAM\Subinv.xls"
If FileExist3(filepath) Then
DoCmd.TransferSpreadsheet acImport, , "Subinv", filepath, True
Else
MsgBox "File not found. Please check file name, file extension or file location."
End If
End Sub
Function FileExist3(sTestFile As String) As Boolean
Dim lsize As Long
On Error Resume Next
lsize = -1
lsize = FileLen(sTestFile)
If lsize > -1 Then
FileExist3 = True
Else
FileExist3 = False
End If
MsgBox ("Sub Inventory Data upload successfully")
End Function
PLEASE HELP


R/s,
Michael
Last edited: