So you have a big one here. I would not try it with a Spreadsheet if you’re hoping to link the data back to Access/MDB. The simple fact is that JET can handle the creation of the spreadsheets easy enough but linking the changes back will be maybe more then you can handle due to end-users borking the files up…
Try this maybe. Create the data back out to each user each month as a snapshot of data. Then create a import back into the main database based as temp tables, then update the data files points. If you do it like each CSV/XLS is stored in a IMPORT directory like c:\import\1 c:\import\2 you can simply sweep those directories calling each directory a TEMP table in the database.
Like this:
Use this FileSearch code to check the directory
Function FilesSearch(thepath As String, Ext As String)
Dim unkndir() As String
Dim tempdir As String
Dim ff As String
Dim DirCount As Integer
Dim X As Integer
DirCount = 0
ReDim unkndir(0) As String
unkndir(DirCount) = ""
If Right(thepath, 1) <> "\" Then
thepath = thepath & "\"
End If
DoEvents
tempdir = Dir(thepath, vbDirectory)
Do While tempdir <> ""
If tempdir <> "." And tempdir <> ".." Then
If (GetAttr(thepath & tempdir) And vbDirectory) = vbDirectory Then
unkndir(DirCount) = thepath & tempdir & "\"
DirCount = DirCount + 1
ReDim Preserve unkndir(DirCount) As String
End If
End If
tempdir = Dir
Loop
ff = Dir(thepath & Ext)
Do Until ff = ""
Found1 = thepath ' & ff
Found2 = ff
ff = Dir
Loop
'searches through all sub direictories
For X = 0 To (UBound(unkndir) - 1)
FilesSearch unkndir(X), Ext
Next X
End Function
Then call it like:
Dim FF as String
DIRY as String
TABL as String
TABL =“TEMP NAME OF TABLE FOR THIS DIRECTORY”
DIRY = “c:\Import\1”
FF= “IMPORT.CSV”
Call FilesSearch(DIRY, ff)
If Len(Found2) > 4 Then
FileCopy Found1 & Found2, “c:\program\import.csv”
Then from here import that file to the temp table
Remember to Kill the FOUND1 & FOUND2 so that directory is empty for next time.
Use something like this for import
Set dbs = DBEngine.Workspaces(0).OpenDatabase(“c:\pathway\path_2000.mdb”, , False)
sSQL = “DELETE * from [Enter table name here]”
dbs.Execute sSQL
sSQL = “Insert INTO [Enter table name here] SELECT * FROM [Text;Database=c:\program;HDR=NO].[Import.csv]”
dbs.Execute sSQL
Then you step thru it all for updating tables other places… then loop around to do for each directory…
Seems like a lot but way faster then hoping to link data back…also the CSV files are smaller then XLS files…and you can have users that simply have older version, or generic Spreadsheets working…also works great for vendors also…
Just me 2 + cents !