Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    348

    Unanswered: Dynamically populating lables

    So I wondered off from dbforms yet again, and here I come wandering back.

    Here's what I'm thinking....
    I have an issues tracking database that has been an on going project for years now. It's kind of my learn by doing application but it's actually being used too. I have always thrown issues into categories (new item, delete item, modify item..). The database is getting more use these days and I'm trying to make it more dynamic to keep up. So I am changing the categories to attributes.

    I built a table that lists attributes and a form with a bunch of checkboxes that are not labeled yet. I would like to use the table to fill in the labels as well as to drive the SQL behind the form. My initial thought went a little something like

    Dim Attribute as string
    Dim AttributeRs as recordset

    AttributeRs.open(glossing over some details here intentionally)

    While Not AttributeRs.EOF Do
    me.Checkbox1Lbl.SetFocus
    me.checkbox1Lbl.Caption = AttributeRs![AttributeName]
    me.Checkbox1.name = AttributeRs![AttributeName]
    me.control.movenext
    Attributers.movenext
    Loop

    So the quest is really, how do I work through each control?
    After playing with it a bit I got to thinking I may need to have a table the holds nothing but the check box names. Even if I go that route, how exactly do I say something that roughly equates to:
    me.ControlsRs![ControlName].Caption = AttributesRs![AttributeName]


    Please feel free to ask questions to clarify my questions.

    It feels good to be back.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Just so long as this ain't an EAV.... (try googling EAV ebfore you go too far down this road if you don't know what this means).

    As for code:
    Code:
    Me.Controls("checkbox" & i & "lbl").Caption = AttributeRs![AttributeName]
    Now you just need to increment i for each iteration of the recordset.

  3. #3
    Join Date
    Feb 2007
    Posts
    348
    That was a good database modeling lesson. I believe, from what I read on wikipedia, that I am using the row modeling method. I intend to have a table that holds the list of attributes with and AutoID as well as a number field to allow me to customize the sort order. Then I intend to have a transaction table that will hold and AutoID, The IssueID and the AttributeID. No other Attribute specific data is recordable, which I believe is the difference between EAV and Row Modeling.
    Let me know if I don't sound like I know what I am saying here.

  4. #4
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    No that sounds fine - always hard to tell from a quick synopsis on a site.

    Anyhoo - does the code solution help?

Posting Permissions

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