Sunday, April 29, 2012

delete a table & import table from excel



Exported from Notepad++
Option Compare Database Sub TestVariables() Dim db As Database, tbl As DAO.TableDef Set db = CurrentDb() DoCmd.DeleteObject acTable, "MyTestingTable" DoCmd.TransferSpreadsheet acImport, , "MyTestingTable", "C:\Users\Twins\Desktop\Access\MyTestingTable", True 'Importing the Excel Data Dim DayF As Date Dim DayL As Date DayF = DFirst("DateTran", "MyTestingTable") DayL = DLast("DateTran", "MyTestingTable") x = DayF Do Until x = DayL + 1 If Month(x) <> 2 Then MsgBox x x = x + 1 ElseIf Month(x) = 2 Then MsgBox "hi" End If MsgBox x x = x + 1 Loop End Sub


No comments:

Post a Comment