In my code I want to instantiate a new form without the form opening. I tried this:

[vba]Private Sub Command1_Click

'instantiate the form

Dim frm as New Form 'or Access.Form




'Do anything with the form, such as:

frm.RecordSource= "Select * from tblItems"
debug.print frm.RecordSource

set frm=nothing
End Sub[/vba]
Whenever I try to do anything with the frm object, I get error 429 "ActiveX Component can't create the object".


I am using Access 2010 from Office Professional and I have windows XP.

I have the following libraries active:
  1. Visual Basic For Applications
  2. Microsoft Access 14.0 Object Library
  3. OLE Automation
  4. Microsoft Office 14.0 Access database engine Object
  5. Microsoft Forms 2.0 Object Library
I do not want to use the createForm method because having the form opening and being visible will be distracting to the user (and perhaps slow down the code).

I have seen people use "Dim frm as New Form". Why is it not working for me?