At an impasse, (a complete loss as to where to go next)
I am building a powershell script to automate a number of manual tasks one of which is to run a query within access and then email that object to a number of recipients.
The closest I have got to was running
$Acc = New-Object -com Access.Application
$Acc.OpenCurrentDataBase("L:\Operations Database\OPS\OPS-V2.0.accdb")
##Test email object
$Acc.DoCmd.RunMacro("EmailLiveFNZ")
This ran the macro that I had produced in Access but I was then required to manually click on an Outlook warning box so it has not resolved the issues.
I have then started playing around with various versions of the following script but can't get it to work.
$Acc = New-Object -com Access.Application
$Acc.OpenCurrentDataBase("L:\Operations Database\OPS\OPS-V2.0.accdb")
##Test email object
$Acc.DoCmd.SendObject acSendQuery, "LiveFNZFundXfer", acFormatXLS, _
"email@address.com", , , _
"Live Transfers", , False
I am assuming that I can send the query out using powershell automatically I just can't find the assistance I need online...
Alternatively if anyone knows how to save an access object to a specific folder location on a PC I could have the script email the file from there, I can't work it out...
Thanks for your help!
Regards
R
I also tried;
$Acc = New-Object -com Access.Application
$Acc.OpenCurrentDataBase("L:\Operations Database\OPS\OPS-V2.0.accdb")
##Test export object
$Acc.DoCmd.OpenQuery("LiveFNZFundXfer") | Export-CSV "C:\LiveFNZFundXfer.csv"
This compiles without errors but does not export anything