I looked through the code.......
I have to keep doing a hard close (using TaskManager) because of the errors.
First, do you have these two lines at the top of EVERY module?
Code:
Option Compare Database
Option Explicit
Next, I found an error in the "GetFolder" code (that is in RED that you should have seen and fixed).
Code:
Function GetFolder() As String
Dim fldr As FileDialog
Dim sItem As String
Set fldr = Application.FileDialog(msoFileDialogFolderPicker)
With fldr
.Title = "Select a Folder"
.AllowMultiSelect = False
.InitialFileName = ‘ADD DEFAULT DIRECTORY
If .Show <> -1 Then GoTo NextCode
sItem = .SelectedItems(1)
End With
NextCode:
GetFolder = sItem
Me.Excel_File_Directory = sItem
Set fldr = Nothing
End Function
This an oddly named parameter. Even though it is "InitialFileName", it is actually the initial path. If you were picking a file, you would also set the filter property. So you need to (or should) set an initial (default) path OR comment out the line.
Next the "GOTO" command. It would have been so much easier to use the block form of the IF() function... like this
Code:
If .Show <> -1 Then
sItem = .SelectedItems(1)
End If
End With
It would have automatically gone to the "NextCode:" label WITHOUT having to use the depreciated GOTO command. (actually, you wouldn't need the label)
What does this code do?
Code:
Do While lngItem < 50000
lngItem = lngItem + 1
Call UpdateProgress(lngItem, lngTotal, "Importing Trans Data...")
Loop
Looks to me that it is an attempt to use a progress bar. Don't know where the value of lngTotal is set.
The progress does not really show the progress of anything but being able to count.
Code:
DropTable DBPath, "W_MAIN_TEMP"
Then there is a function to delete tables.
There are parameters to set the table name and the BE name. IMHO, it is better to delete the RECORDS, than to constantly delete, then create the tables.
And not a lick of error handling........ I would expect it in at least the sub Import_but_Click().