PDA

View Full Version : "Dim frm as New Form" does not work



jrajul
03-14-2011, 06:10 PM
In my code I want to instantiate a new form without the form opening. I tried this:

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
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:
Visual Basic For Applications
Microsoft Access 14.0 Object Library
OLE Automation
Microsoft Office 14.0 Access database engine Object
Microsoft Forms 2.0 Object LibraryI 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?

HiTechCoach
03-15-2011, 09:47 PM
If you are wanting to make design changes to the form you can open the form in design mode.

It would help to know hat you are wanting to do. Will you give us more details?