Thoughts on logic for this process:
1. table with info: PayeeID, Amount, DateStart, Frequency
2. When do you want the procedure for posting transactions to register triggered - by code in open event of default open form? Database must be closed each night then reopened each morning. Unfortunately, still depends on someone pushing a button. If this event does not occur because of absence (sick, vacation, holiday), the postings will not take place. I have one recurring event in my database (send an email) that is triggered in default form open event. I have a VBScript that opens database. I use Windows TaskManager to run the VBScript each day before 8am. Create a VBScript with Notepad and change the extension from txt to vbs. This is my script:
Code:
Option Explicit
Dim objWMIService, objProcess, colProcess
Dim strComputer, strProcessKill
strComputer = "."
strProcessKill = "'msaccess.exe'"
If (Month(Date()) >= 6 And Month(Date()) <= 9) Or ((Month(Date()) <= 5 Or Month(Date()) >= 10) And Day(Date()) < 8) Then
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcess = objWMIService.ExecQuery ("Select * from Win32_Process Where Name = " & strProcessKill )
For Each objProcess in colProcess
objProcess.Terminate()
Next
Dim objFSO, oShell
Set objFSO = CreateObject("Scripting.FileSystemObject")
'open the Access file
Set oShell = CreateObject("WScript.Shell")
oShell.Run """C:\Program Files\Microsoft Office\Office12\msaccess.exe"" ""\\server\path\filename.accdb"""
End If
3. pseudocode for retrieving and posting payees to register - perhaps an INSERT SELECT sql action for each category:
monthly payees where Day(DateStart)=Day(Date())
only run weekly payees on each Thursday so IIf Weekday(Date()) = 5
one-time payees where StartDate = Date()
4. print checks