Results 1 to 3 of 3
  1. #1
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919

    How to use the "Position Bring to Front" at runtime?

    I Have a report with two text boxes super-imposed. Depending on which back-end DB is active, I need to bring the appropriate text box to the front of the other. I tried to accomplish the desired results by toggling the visibility property without success. (The text boxes float beneath a sub-report container that sizes at runtime.)


    Code:
    '  intBEIndex=: 0 "Personal", 1 "CreditCards" and 2 "Business"
    Select Case intBEIndex
        Case 0, 2
            Me.tbSumDeb.Visible = True
            Me.tbSumCrd.Visible = False
        Case 1
            Me.tbSumCrd.Visible = True
            Me.tbSumDeb.Visible = False
    End Select
    I've also tried a single text box where I attempted to change its ControlSource at runtime, but Access would not allow that action in either the Open Event or the OnLoad Event.

    The thought the easiest way would be to simply populate both TB's and position one in front of the other, but I can find no reference to a "Bring to Front" property for the control.

  2. #2
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,430
    There isn’t one

    only way to do it may be give it the focus

    mycontrol.setfocus

  3. #3
    GraeagleBill's Avatar
    GraeagleBill is offline Experienced Old Geezer
    Windows 10 Access 2013 32bit
    Join Date
    Feb 2011
    Posts
    1,919
    Turns out, with some well placed debug code, that the first incident of the report does not get closed. So, the subsequent incident does not execute the open code where the properties of the two tb controls are subject to change. What masked it from a normal appearance of report preview is that the report is opened and sent to a PDF file directly, without user intervention, where it's only the pdf file that is closed by the user. Thus, it's the responsibility of that special direct PDF module to close the report after the PDF file is closed.

    I discovered the condition when I tested this code and the MsgBox statemtment didn't fire:
    Code:
    inttbHeight = Me.tbSumDeb.Height
    MsgBox inttbHeight
    
    
    '  intBEIndex=: 0 "Personal", 1 "CreditCards" and 2 "Business"
    Select Case intBEIndex
        Case 0, 2
            Me.tbSumDeb.Height = inttbHeight
            Me.tbSumCrd.Height = 0
        Case 1
            Me.tbSumCrd.Height = inttbHeight
            Me.tbSumDeb.Height = 0
    End Select
    I have reverted back to what I coded when I first created the report, where both TB visible properties are set to No.
    Code:
    '  intBEIndex=: 0 "Personal", 1 "CreditCards" and 2 "Business"
    Select Case intBEIndex
        Case 0, 2: Me.tbSumDeb.Visible = True
        Case 1: Me.tbSumCrd.Visible = True
    End Select

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

Similar Threads

  1. "Y" position of a text box control on a continuous form
    By GraeagleBill in forum Programming
    Replies: 20
    Last Post: 02-18-2019, 06:07 PM
  2. Replies: 2
    Last Post: 01-04-2016, 04:44 AM
  3. Replies: 2
    Last Post: 12-23-2015, 09:32 PM
  4. Replies: 1
    Last Post: 09-07-2015, 08:00 AM
  5. Replies: 1
    Last Post: 10-19-2009, 02:37 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