Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

delete table after certain number of days

Status
Not open for further replies.

EBee

MIS
Aug 10, 2001
229
US
How can I delete the table after a certain days or >= to the certain date. Thank you


Private Sub cmdImportData_Click()
Dim Response As Integer
Dim rst As ADODB.Recordset

Set rst = New ADODB.Recordset
rst.ActiveConnection = CurrentProject.Connection


Response = MsgBox("Are you sure you want to import new data?", vbOKCancel, "WARNING!!")

' DoCmd.DeleteObject acTable, "tblAllAddresses" & "_mmddyyyy_hhmmss" - 30

If Response = vbOK Then

DoCmd.Rename "tblAllAddresses_" & Format(Now, "mmddyyyy_hhmmss"), acTable, "tblAllAddresses"

DoCmd.TransferDatabase acImport, "Microsoft Access", _
"\\sbserver02\Circulation Transfer\Circ Admin Share\ThirdPartyData\PaidPlus.mdb", acTable, "tblAllAddresses", "tblAllAddresses"


MsgBox "Table Import Complete"

' rst.Open "tblAllAddresses", , adOpenKeyset, adLockOptimistic
' rst.Sort = "[RandomID]"
Else

Exit Sub
End If

DoCmd.RunSQL "Drop table dbo_Districts"

DoCmd.RunSQL "drop table dbo_Routes"

DoCmd.TransferDatabase acImport, "Microsoft Access", _
"\\sbserver02\Circulation Transfer\Circ Admin Share\ThirdPartyData\PaidPlus.mdb", acTable, "dbo_Districts1", "dbo_Districts"

DoCmd.TransferDatabase acImport, "Microsoft Access", _
"\\sbserver02\Circulation Transfer\Circ Admin Share\ThirdPartyData\PaidPlus.mdb", acTable, "dbo_Routes1", "dbo_Routes"


End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top