Results 1 to 5 of 5

Thread: variable question?

  1. #1

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249

    Question

    I want to use a variable in a module to do the following:

    cboComboBox.Clear

    In a module, you have to specify which form on which this is supposed to happen. I want to have the form name be a variable so that I can use this code with several forms. On the form, I have the following code:

    strFormName = Me.Name

    The following code, which I am putting in my module is incorrect, but how do I fix this?

    strFormName!cboComboBox.Clear
    Normal is boring...

    smh

  2. #2
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    Declare a variable to hold the form itself, not the name of the form...

    Code:
    Dim frmForm As YourForm
    
    Set frmForm = Me
    
    .....
    
    
    frmForm.cboComboBox.Clear
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

  3. #3

    Thread Starter
    Addicted Member smh's Avatar
    Join Date
    Oct 2000
    Location
    South Dakota, USA
    Posts
    249
    I can not use the type "YourForm". Why?
    Normal is boring...

    smh

  4. #4
    Addicted Member
    Join Date
    Mar 2001
    Posts
    130

    Wink

    Try Dim frmForm As Form

    -Mort

  5. #5
    Hyperactive Member
    Join Date
    Feb 2001
    Location
    LoCal
    Posts
    280
    smh,

    Sorry. "YourForm" was meant to be replaced by whatever you had defined your Form as... for example I have a form I use to edit patients called PatientEdit so for me it would look like...

    Dim frmForm as PatientEdit

    But Mortivan's suggestions should work as well.
    Achichincle

    VB6 (VSEE SP5, W2KPro)
    ASP
    HTML

Posting Permissions

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



Click Here to Expand Forum to Full Width