none
Moving text box in run time RRS feed

  • Question

  • I have a report with 4 calculated text boxes side by side in the details section. I am trying to move these boxes left and right in run time based on whether there is value in some of them or not. So that, if TxtBox1 is null and TxtBox2 is not, then TxtBox2 will move left to where TextBox1 is, and so on. Is there a way to do that? I tried a code in the 'on format' event similar to the code below:

    If IsNull(Me.TxtBox1) Then
        Me.TxtBox2.Left = 4043
    Else
        Me.TxtBox2.Left = 6243
    End If

    I am using twips number as 1 inch = 1441 twips

    this did not work for some reason. additionally, TxtBox1 can be blank and populated, depending on the record.

    Wednesday, October 12, 2016 9:07 PM

Answers

  • Hi,

    Rather than use an event to display "Critical," you should be able to add this as a calculated column in your Record Source and just bind a Textbox to it.

    Hope it helps...

    • Marked as answer by al.sallam Thursday, October 13, 2016 4:13 PM
    Thursday, October 13, 2016 3:12 PM

All replies

  • Hi,

    What exactly does "did not work" mean? Have you tried printing the report out right to see if it actually didn't work? Just curious...

    Wednesday, October 12, 2016 9:12 PM
  • It means that when I ran the report the box did not move as expected per the code I attached
    Wednesday, October 12, 2016 10:04 PM
  • It means that when I ran the report the box did not move as expected per the code I attached

    Hi,

    Sorry but what exactly does "run the report" mean? Did you actually print the report? Just in case you're not aware, some events, such as the Format event, may or may not fire depending on how you were "running" the report. For example, the Format event won't fire if you open the report in Report View. However, it will fire when you open the report in Print Preview.

    Just my 2 cents...

    Wednesday, October 12, 2016 10:08 PM
  • Yes, you are right, I was running the report in the 'Report View', when I ran it in the 'Print Preview' the code fired and worked fine, however, another issue appeared. I have calculated test box with the following formula:=IIf(Not IsNull([TxtBox1]),"- Critical, ","")

    in the 'Report View' code does not work (because it does not fire like you said) but the formula works fine, however, in the 'Print Preview' the Code fires and works fine but the formula does not. Let me explain how, I have only one row where the TxtBox1 has value, which means that the calculated box formula should show blank "" in all rows except for that row, it should show 'Critical', what is happening is that the calculated box is blank all the way. what am I doing wrong?

    Thursday, October 13, 2016 2:58 PM
  • Hi,

    Rather than use an event to display "Critical," you should be able to add this as a calculated column in your Record Source and just bind a Textbox to it.

    Hope it helps...

    • Marked as answer by al.sallam Thursday, October 13, 2016 4:13 PM
    Thursday, October 13, 2016 3:12 PM
  • It is a calculated field as I stated above.
    Thursday, October 13, 2016 4:01 PM
  • Never mind my last reply, I got what you mean, I did it in the record source query and it works, thanks
    Thursday, October 13, 2016 4:13 PM
  • Never mind my last reply, I got what you mean, I did it in the record source query and it works, thanks

    Hi. You're welcome. Glad to hear you got it to work. Good luck with your project.
    Thursday, October 13, 2016 4:25 PM