Consulting

Results 1 to 2 of 2

Thread: "Dim frm as New Form" does not work

  1. #1
    VBAX Regular
    Joined
    Feb 2011
    Posts
    27
    Location

    "Dim frm as New Form" does not work

    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?

  2. #2
    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?
    Boyd Trimmell aka HiTechCoach
    Microsoft Access MVP -2010-2015

    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •