Results 1 to 4 of 4
  1. #1
    karmacable is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    24

    Form with Label captions that size dynamically

    I'm wondering if it's possible to create label captions that dynamically grow to show all the contents of a selected item (but not empty values), and push other boxes down as a result. I may be totally going about this the wrong way, but let's see how clear an example I can give.

    tblOrder
    **OrderID (PK-Autonumber)
    **OrderName (text)
    **ComputerID (number)

    tblComputer
    **ComputerID (PK-Autonumber)
    **ComputerName (text)
    **Part1 (text)
    **Part2 (text)
    **Part3 (text)

    frmOrder (uses tblOrder as source)
    **cboComputerName1
    **cboComputerName2

    frmDetail (this will show the detailed parts from the computer selection, like a Report)

    So on frmOrder, a user makes a selection from two comboboxes for computers. Let's say we have two types of computers, and here's there listed parts;

    **ComputerName - Dell
    **Part1 - Power Adapter


    **Part2 - Keyboard & Mouse
    **Part3 - Monitor

    **ComputerName - Gateway
    **Part1 - Power Adapter
    **Part2 - (blank)
    **Part3 - (blank)

    If the user chooses in order, a Gateway and a Dell, then clicks a command button which opens up the frmDetail, my label's pre-sized captions will currently look like this;

    Computer: Gateway
    - Power Adapter


    Computer: Dell
    - Power Adapter
    - Keyboard & Mouse
    - Monitor


    I want it however, to look like this;

    Computer: Gateway
    - Power Adapter
    Computer: Dell
    - Power Adapter
    - Keyboard & Mouse
    - Monitor

    Is there a way to make it shrink / grow dynamically to accommodate the part names, based on whether there are values or not? Let me know if there is any needed information I've left out.

    If a report's the only way to go about for this, then feel free to point me to a thread similar to my issue.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    In a report you can use Can Grow & Can Shrink. If memory serves, those don't work on a form.

    In any case, you have a design flaw there. You should not have the 3 part fields; what are you going to do when you need a 4th or 5th part? You should have a related table with computer ID and part. The computer with 3 parts would have 3 records in that table, the computer with 1 part would only have 1 record. Then your db is flexible and dynamic.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    karmacable is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Sep 2011
    Posts
    24
    Thanks for pointing out the design flaw, it makes sense. I'll have to figure out what to do for my reporting now...

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,652
    No problem. Your reporting should get easier, because those blank rows don't exist anymore. Post back if you get stuck.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-28-2011, 06:40 PM
  2. Replies: 2
    Last Post: 06-01-2011, 09:32 AM
  3. Replies: 1
    Last Post: 04-29-2010, 05:15 PM
  4. Replies: 0
    Last Post: 11-24-2009, 03:23 PM
  5. Change of label size
    By Zoroxeus in forum Programming
    Replies: 0
    Last Post: 06-11-2007, 08:18 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums