At the close of each accounting period, I would like to rename the current month table to a prior month table and then create the new month's table. The tables exist in another database and are fairly large so I prefer to rename vs. copy. This is the direction I am going but am not much of a VBA programmer. Any help will be appreciated!
Dim dbcurrent As Database
Set dbcurrent = CurrentDb()
Dim dbmthly As DAO.Database
Dim ws As DAO.Workspace
Dim rst As Recordset
Dim prevperiod As Variant
Set rst = dbcurrent.OpenRecordset("endofmth"
If rst![PeriodEnd] = "Yes" Then
Set prevperiod = rst![priorperiod]
Set ws = DBEngine.Workspaces(0)
Set dbmthly = ws.OpenDatabase("r:\pra\reporting\sales channel.mdb"
dbcurrent.Close
DoCmd.Rename "SalesChannel_Monthly" & "_"&"prevperiod", acTable, "SalesChannel_Monthly"
End If
Dim dbcurrent As Database
Set dbcurrent = CurrentDb()
Dim dbmthly As DAO.Database
Dim ws As DAO.Workspace
Dim rst As Recordset
Dim prevperiod As Variant
Set rst = dbcurrent.OpenRecordset("endofmth"
If rst![PeriodEnd] = "Yes" Then
Set prevperiod = rst![priorperiod]
Set ws = DBEngine.Workspaces(0)
Set dbmthly = ws.OpenDatabase("r:\pra\reporting\sales channel.mdb"
dbcurrent.Close
DoCmd.Rename "SalesChannel_Monthly" & "_"&"prevperiod", acTable, "SalesChannel_Monthly"
End If