none
message box affects display of Dsum RRS feed

  • Question

  • greetings,

    have a textbox bound to =DSum(  )

    in the code module I make the text box visible and requery it, in case the record set has changed

    this all works fine

    below these code lines is a msgbox code line

    the form behavior is that the textbox will become visible, but its Dsum value is blank and the message box opens

    only until one presses OK to close the message box does the Dsum in the textbox display

    it's quirky to see this - - but not finding a way to change the form behavior....

    Tuesday, September 10, 2019 4:02 PM

Answers

  • Try calling the DoEvents function to yield control to the operating system within a delay loop before calling the MsgBox function.  Also try calling the form's Recalc method rather the Requery method.  The latter reloads the form's recordset, whereas the former does what it says on the tin.

    Ken Sheridan, Stafford, England

    Tuesday, September 10, 2019 8:04 PM

All replies

  • Something you are missing..the msgbox doesn't fires on its own...

    Probably you are calling it somehow...

    Tuesday, September 10, 2019 4:51 PM
  • yes, as per the original post there is a code line for the msgbox

    but that code line is after the textbox

    txtbox.visible

    txtbox.requery

    msgbox

    …..and the question is while the textbox displays....why does the =DSum inside of the textbox not display until the msgbox is closed manually via its OK button ….

    Tuesday, September 10, 2019 5:10 PM
  • Dsum is slow...maybe it releases the program execution and it moves to the msgbox...

    Tuesday, September 10, 2019 5:32 PM
  • Just gave it a shot...

    Change your code like this

    txtbox.visible

    Me.Requery

    msgbox


    Tuesday, September 10, 2019 5:38 PM
  • this order:

    txtbox.visible

    me.requery     (form)

    msgbox

    …...results in the textbox value showing before/when the msgbox opens - which is the goal BUT the txtbox is not updated to the most recent record set...so it works the first time but if you change the record set the DSum is based upon the value doesn't change...

    txtbox.visible

    txtbox.requery

    me.requery  (form)

    msgbox

    ….this behaves as per the original post - no value in the textbox until the msgbox is closed by the user....also tried Refresh and Repaint for the form....

    ...probably could pop up a form with this message but kind of want to understand what's going on....

    Tuesday, September 10, 2019 7:46 PM
  • If i don't have the whole application i cannot make assumptions.
    Tuesday, September 10, 2019 7:59 PM
  • Try calling the DoEvents function to yield control to the operating system within a delay loop before calling the MsgBox function.  Also try calling the form's Recalc method rather the Requery method.  The latter reloads the form's recordset, whereas the former does what it says on the tin.

    Ken Sheridan, Stafford, England

    Tuesday, September 10, 2019 8:04 PM
  • well KS you hit the nail on the head; this works:

    txtbox.visible

    txtbox.requery

    me.recalc  (form)

    msgbox

    ….I guess I didn't know there was a recalc, thought that requery or refresh did that function....  much thanks.

    Tuesday, September 10, 2019 9:49 PM