+ Reply to Thread
Results 1 to 5 of 5

Showing Forms using a public variable

  1. #1
    Registered User
    Join Date
    02-15-2006
    Posts
    14

    Question Showing Forms using a public variable

    Hi,

    I've hit a wall with a model I am currently building. It is a data collection system for several metrics each of which has a different number of componenets.

    I have several data entry forms, one for each possible number of components for a metric. They are named:
    frm3PartDataEntry
    frm4PartDataEntry etc..

    The problem comes when I wish to show them. The user is selecting a metric from a list box and hitting an enter data button. When they do this I look up the number of components the metric they have selected has and store this in a public variable NumberOfComponents.

    I had hoped that to show the form, the following code would work:
    frm & NumberOfComponents & PartDataEntry.Show

    Sadly it won't compile, and aside from writing a horrible Select Case I'm stumped as to what to do.

    Any advice would be greatly appreciated.

    Thanks in advance,

    Adam

  2. #2
    Kris
    Guest

    Re: Showing Forms using a public variable

    Adamaths wrote:
    > Hi,
    >
    > I've hit a wall with a model I am currently building. It is a data
    > collection system for several metrics each of which has a different
    > number of componenets.
    >
    > I have several data entry forms, one for each possible number of
    > components for a metric. They are named:
    > frm3PartDataEntry
    > frm4PartDataEntry etc..
    >
    > The problem comes when I wish to show them. The user is selecting a
    > metric from a list box and hitting an enter data button. When they do
    > this I look up the number of components the metric they have selected
    > has and store this in a public variable NumberOfComponents.
    >
    > I had hoped that to show the form, the following code would work:
    > frm & NumberOfComponents & PartDataEntry.Show
    >
    > Sadly it won't compile, and aside from writing a horrible Select Case
    > I'm stumped as to what to do.
    >
    > Any advice would be greatly appreciated.
    >
    > Thanks in advance,
    >
    > Adam
    >
    >


    Build one frmNPartDataEntry with maximum number of components and hide /
    disable some of them.

  3. #3
    Registered User
    Join Date
    02-15-2006
    Posts
    14
    Thanks for the suggestion.

    It knid of raises the same problem though in terms of determining and making not visible the unrequired components.

    Since each component has about 5 labels or textboxes on the form is there again a simple way to code:
    For i = MaxComponents to Number of Components
    frmNPartDataEntry.txtbxPart & i.visible = False
    Next i

    Thanks in advance

    Regards,

    Adam

  4. #4
    Bob Phillips
    Guest

    Re: Showing Forms using a public variable

    See this previous post http://tinyurl.com/8ftm5

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Adamaths" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hi,
    >
    > I've hit a wall with a model I am currently building. It is a data
    > collection system for several metrics each of which has a different
    > number of componenets.
    >
    > I have several data entry forms, one for each possible number of
    > components for a metric. They are named:
    > frm3PartDataEntry
    > frm4PartDataEntry etc..
    >
    > The problem comes when I wish to show them. The user is selecting a
    > metric from a list box and hitting an enter data button. When they do
    > this I look up the number of components the metric they have selected
    > has and store this in a public variable NumberOfComponents.
    >
    > I had hoped that to show the form, the following code would work:
    > frm & NumberOfComponents & PartDataEntry.Show
    >
    > Sadly it won't compile, and aside from writing a horrible Select Case
    > I'm stumped as to what to do.
    >
    > Any advice would be greatly appreciated.
    >
    > Thanks in advance,
    >
    > Adam
    >
    >
    > --
    > Adamaths
    > ------------------------------------------------------------------------
    > Adamaths's Profile:

    http://www.excelforum.com/member.php...o&userid=31580
    > View this thread: http://www.excelforum.com/showthread...hreadid=512724
    >




  5. #5
    Registered User
    Join Date
    02-15-2006
    Posts
    14
    Many thanks - that works a treat.

    On a related note do you know of a similar method to scroll through labels on a form to populate them.

    For example if I have now loaded a four part form is there a method to do:

    For i = 1 to NumberOfComponents
    FormName.lblPart & i.Value = variable name
    Next i

    Again any help is greatly appreciated.

    Adam.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1