PDA

View Full Version : Importing in Access creating dublicate table



nkechifesie
06-27-2007, 02:10 AM
I was given a database program in Access to improve. This included enabling an exported table in excel which after update should be able to import back into the previous table.
The issue is that the table name has a space. I tried putting it in brackets but this is causing it to be duplicated adding 1,2... to the end of the table name.
I tried changing the name but there are so many codes, macros and queries attached to this table.Please how can I use my code
the table name is "T_Global tracking".
This is my code:


Set DBBsc = DBEngine.Workspaces(0).Databases(0)
Set QBsc = DBEngine.Workspaces(0).Databases(0)
Set QBsc = DBBsc.CreateQueryDef("", "DELETE * FROM [T_GLobal tracking]")
QBsc.Execute
QBsc.Close
DBBsc.Close
Set QBsc = Nothing
Set DBBsc = Nothing
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "[T_GLobal tracking]", "C:\GLobal tracking.xls", True
MsgBox "The Global tracking has been updated", vbOKOnly, "SITE TRACKING"

OBP
06-27-2007, 09:26 AM
Can I offer you an alternative method?
I always import data in to a temporary Table (cunningly called Temp) and then use 2 simple queries, one to "Append" new data to the original Table and one to "Update" the Data in the Table.

nkechifesie
06-28-2007, 02:11 AM
Please could you show me an example

OBP
06-28-2007, 02:26 AM
This is one version.