I have a form in MS Access that I have to fill very often. I would like to automate filling the from. As I am just a user, I don't have access to the database itself, it's password protected. I would like just to fill the fields in the form, without submitting it or creating a new record in the database. So what I need is: form opens, the fields are already filled and I manually click Submit button.
I attach the screen of a part of a form to show what I mean.
I know how the form is called in the base - frm_MainManu. What is more I am in general new to PowerShell, so maybe what I have now (and is below) is completely wrong (or maybe not?).
What I have now is:
$FormFile = "FileWithForm"
$oAccess = New-Object -com Access.Application
$oAccess.Visible=$true
$oAccess.OpenCurrentDataBase($FormFile)
$oAccess.DoCmd.OpenForm('frm_MainMenu')
$AccForm = $oAccess.Forms.Item("frm_MainMenu")
$AccForm.Controls.Item("Reference_3").value = "Refvalue"
After executing the code I get an following error:
You cannot call a method on a null-valued expression.
At line:12 char:1
+ $AccForm.Controls.Item("Reference_3").value = "Refvalue"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The file with the form opens, as I understand there is a problem with filling the fields? How do I do it?
Thank you!

.Itemelement.