I need to pass a Date from VBA to an Access 2007 query. Very little information exists. Most of it is related to Macros. I need help with it in VBA.
I pull a Date field into my VBA. I need to subtract 1 year from it, and then pass it using a TempVar to an Access 2007 Append query. My understanding is that TempVars are available to Access Queries. My problem is that there is almost no practical information on TempVars. Here is my code so far:
Code:
Private Sub BTNNewPYD_Click()
Dim stFFTaxYear As Date 'Current File Tax Year
Dim stVar1 As TempVar
stFFTaxYear = Me.TaxYear
stFFTaxYear = (DateAdd("YYYY", -1, stFFTaxYear))
stVar1 = stFFTaxYear 'It errors out on this line. Error 91 Object Variable or With Block variable not set.
Can anyone help or point me in a practical direction?
Thanks Phred