Results 1 to 10 of 10
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Switchboard Formatting applies to sub-form (2003)

    I have created a switchboard and I've made the text for option 3 red and bold, because I want the user to be careful about using the option.
    One of the buttons invokes a second switchboard containing all the report options for the database - but the text for the third option on the sub-switchboard is also red and bold. If I remove this, then it disappears from the top level switchboard, too.
    How can I remove the formatting from the sub-switchboard while leaving it on the top level switchboard, please?
    Thanks
    Silverback
    Silverback

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    The switchboard generated by Tools | Database Utilities | Switchboard Manager contains only a single set of option labels. Their captions and actions are changed dynamically by VBA code when the user activates another switchboard page. So if you change the formatting of the label for the third option, this will apply to the third option in all switchboard pages. Instead of changing the formatting in design view, you must do it in code. The code that sets the label captions is the FillOptions procedure.
    In the code below, the addition to make the caption red and bold for the 3rd option in the main switchboard only is indicated in bold:

    ...
    Else
    While (Not (rs.EOF))
    Me("Option" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
    With Me("OptionLabel" & rs![ItemNumber])
    If Me!SwitchboardID = 1 And rs!ItemNumber = 3 Then
    .ForeColor = vbRed
    .FontBold = True
    Else
    .ForeColor = vbBlack
    .FontBold = False
    End If
    End With

    rs.MoveNext
    Wend
    End If
    ...

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    I see, now, how the switchboard is completed and why the formatting passes through.
    However, I've tried the code and it doesn't work - all options remain black, not bold.
    I tried creating another switchboard in case my specific formatting of the top level one had somehow prevented the VBA code from working, but all these options remain black and not bold, too.
    Here's the code I inserted. I must have done something wrong - can you tell me what, please.
    Thanks
    Silverback
    ....
    <pre> Else
    While (Not (rs.EOF))
    Me("Option" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Visible = True
    Me("OptionLabel" & rs![ItemNumber]).Caption = rs![ItemText]
    With Me("OptionLabel" & rs![ItemNumber])
    If Me!SwitchboardID = 1 And rs!ItemNumber = 3 Then
    .ForeColor = vbRed
    .FontBold = True
    Else
    .ForeColor = vbBlack
    .FontBold = False
    End If
    End With
    rs.MoveNext
    Wend
    End If</pre>

    Silverback

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    I started from the default switchboard as created by the Switchboard Manager on my system. Perhaps your version works slightly differently. Could you post a stripped down copy of your database? See <post#=401925>post 401925</post#> for instructions. (We need to see only the Switchboard Items table and the Switchboard form, nothing else)

  5. #5
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Thanks Hans
    Stripped DB attached.
    Silverback
    Silverback

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Apparently, you have at some point deleted the switchboard page that was originally the first one. Your main switchboard has SwitchboardID =2, not 1. So change

    If Me!SwitchboardID = 1 And rs!ItemNumber = 3 Then

    to

    If Me!SwitchboardID = 2 And rs!ItemNumber = 3 Then

    and it should work OK.

  7. #7
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Hmmm
    Just created a new clean DB and a top level and second level Switchboard.
    The code works perfectly.
    If a fix can't be found, I'll delete the old switchboard and table from the real DB and recreate from scratch.
    Thanks
    Silverback
    Silverback

  8. #8
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Thanks, Hans
    It's all working now.
    I really can't remember deleting a switchboard, so apologies for misleading you.

    Q1 : Please can you say how to determine that the switchboard is number 2 and not number 1.
    Q2 : If I delete the switchboards and start again, will the top level switchboard number return to zero?

    Thanks again
    Silverback
    Silverback

  9. #9
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Hi Silverback,

    All infornation about the switchboard pages is stored in the Switchboard Items table. This table has 5 fields:
    <UL><LI>SwitchboardID: a number identifying the Switchboard page; this starts with 1 for a newly created switchboard.
    <LI>ItemID: the record with value 0 is used to store inforrmation about the switchboard page, values 1 through 8 correspond to the items on the page.
    <LI>ItemText: for ItemID = 0 this is the title of the switchboard page, for ItemID = 1, ..., 8 it is the caption of the option label.
    <LI>Command: a number indicating the action to be executed by the switchboard option (1 = activate another switchboard page, 2 = open a form in add mode, etc.)
    <LI>Argument: a string providing additional information, such as the name of the form to be opened.
    The record that contains the text 'Default' specifies the main switchboard page - the one to be displayed when you open the switchboard.[/list]The combination of SwitchboardID and ItemID forms the primary key of the table.

  10. #10
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Warrington, Cheshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Switchboard Formatting applies to sub-form (2003)

    Thank you again for another comprehensive answer which solved the problem.
    I have realised how the switchboard number must have been changed - I have not deleted one per se, but when I create a handover version for the user, I export changed forms, tables etc. to the handover version. I then copy that for use as the new development version. Making the change to put all the reports on the lower level switchboard and exporting both switchboards will have incremented the level from 1 to 2.
    Your reply has made this clear.
    Thank you
    Silverback.
    Silverback

Posting Permissions

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