Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    42

    Unanswered: Object Variables - Forms

    Could somone help me understand form object variables? I am having difficulty using them. I have declared my obj var like:

    Dim frmFormName as New Form_sfrmName <--subform being used here

    I do this in the form module where the but when I try to reference it I get a message saying that it's not set. I don't understand why it's not set when I have declared the object and assigned the var to that form. I am using a sub form which is on my main form. I am trying to check controls on the subform.

    Am I declaring my object variable incorrectly? Can someone explain to me the scope of my object variable and also if there is anything I need to know about using subforms with obj vars?

    Thanks in advance!

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: Object Variables - Forms

    Originally posted by waderw24
    Could somone help me understand form object variables? I am having difficulty using them. I have declared my obj var like:

    Dim frmFormName as New Form_sfrmName <--subform being used here

    I do this in the form module where the but when I try to reference it I get a message saying that it's not set. I don't understand why it's not set when I have declared the object and assigned the var to that form. I am using a sub form which is on my main form. I am trying to check controls on the subform.

    Am I declaring my object variable incorrectly? Can someone explain to me the scope of my object variable and also if there is anything I need to know about using subforms with obj vars?

    Thanks in advance!
    For make a reference to a subform you need the path complete try with this:

    Forms![MainForm]![frmFormName]
    I am not sure of this way.......
    Saludos
    Norberto

  3. #3
    Join Date
    Nov 2003
    Posts
    1,487
    Hmmmmm.....


    Try this:

    Dim frmFormName As SubForm
    Set frmFormName = "mySubFormName"



  4. #4
    Join Date
    Aug 2003
    Posts
    42
    I just ended up declaring a global var

    Global frmName as Form

    and then setting it equal to the form.

    Set frmName as New frmForm

    Now it's global and has scope throughout the project.

    Thanks!

Posting Permissions

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