From: alex on
Refresh unbound textbox

Hello,

Using Access ’03…

I have quite a bit of VBA code that runs a variety of queries.
Between all of the SQL code, I display information to the user in an
unbound textbox on the form. Something like this:
‘’’’’’’’’’’’’’’’’’’’’’’’’
Sub RunQueries()
Me.unboundTextBox = “About to run queries”

Me.unboundTextBox = “Running Query A”
Docmd.runsql(queryA)

Me.unboundTexBox = “Running Query B”
Docmd.runsql(queryB)

…

Me.unbountTextBox = “Running Query Z”
Docmd.runsql(queryZ)

Me.unboundTextBox = “Finished queries”
End sub
‘’’’’’’’’’’’’’’’’’’’’’’’’’’’

The problem is that (on some occasions) the queries will run without
the text being displayed; i.e., the textbox will display “About to run
queries” and then will display “Finished queries.” I thought the
problem was that the queries ran so fast, I just couldn’t see the
textbox change, but this happens even when it takes a few moments for
the queries to finish. E.g., I can see the queries running in the
lower left-hand status bar, but the text will not change.

It’s almost like I need to put in a break (like a msgbox) to get the
textbox to refresh—which works strangely enough? Or possibly to set
the focus back to form/textbox?

Any thoughts?
alex
From: Jeff Boyce on
Alex

Not sure why ...

If this is an intermittent issue, that makes it harder to diagnose!

As a test, maybe you could try adding in something like the following after
each Me.xxxx (untested):

Me!unboundTextBox = "Running Query A"
Me.Repaint

....

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"alex" <sql_aid(a)yahoo.com> wrote in message
news:7ab3123f-5386-4749-a9f0-2a7b96337caa(a)32g2000prq.googlegroups.com...
Refresh unbound textbox

Hello,

Using Access �03�

I have quite a bit of VBA code that runs a variety of queries.
Between all of the SQL code, I display information to the user in an
unbound textbox on the form. Something like this:
�������������������������
Sub RunQueries()
Me.unboundTextBox = �About to run queries�

Me.unboundTextBox = �Running Query A�
Docmd.runsql(queryA)

Me.unboundTexBox = �Running Query B�
Docmd.runsql(queryB)



Me.unbountTextBox = �Running Query Z�
Docmd.runsql(queryZ)

Me.unboundTextBox = �Finished queries�
End sub
����������������������������

The problem is that (on some occasions) the queries will run without
the text being displayed; i.e., the textbox will display �About to run
queries� and then will display �Finished queries.� I thought the
problem was that the queries ran so fast, I just couldn�t see the
textbox change, but this happens even when it takes a few moments for
the queries to finish. E.g., I can see the queries running in the
lower left-hand status bar, but the text will not change.

It�s almost like I need to put in a break (like a msgbox) to get the
textbox to refresh�which works strangely enough? Or possibly to set
the focus back to form/textbox?

Any thoughts?
alex


From: Dirk Goldgar on
Try inserting DoEvents after changing the value of the text box, before
running the next query. For example:

Me.unboundTextBox = �Running Query A�
DoEvents
DoCmd.RunSQL queryA

Me.unboundTexBox = �Running Query B�
DoEvents
DoCmd.RrunSQL queryB


--
Dirk Goldgar, MS Access MVP
Access tips: www.datagnostics.com/tips.html

(please reply to the newsgroup)

"alex" <sql_aid(a)yahoo.com> wrote in message
news:7ab3123f-5386-4749-a9f0-2a7b96337caa(a)32g2000prq.googlegroups.com...
Refresh unbound textbox

Hello,

Using Access �03�

I have quite a bit of VBA code that runs a variety of queries.
Between all of the SQL code, I display information to the user in an
unbound textbox on the form. Something like this:
�������������������������
Sub RunQueries()
Me.unboundTextBox = �About to run queries�

Me.unboundTextBox = �Running Query A�
Docmd.runsql(queryA)

Me.unboundTexBox = �Running Query B�
Docmd.runsql(queryB)



Me.unbountTextBox = �Running Query Z�
Docmd.runsql(queryZ)

Me.unboundTextBox = �Finished queries�
End sub
����������������������������

The problem is that (on some occasions) the queries will run without
the text being displayed; i.e., the textbox will display �About to run
queries� and then will display �Finished queries.� I thought the
problem was that the queries ran so fast, I just couldn�t see the
textbox change, but this happens even when it takes a few moments for
the queries to finish. E.g., I can see the queries running in the
lower left-hand status bar, but the text will not change.

It�s almost like I need to put in a break (like a msgbox) to get the
textbox to refresh�which works strangely enough? Or possibly to set
the focus back to form/textbox?

Any thoughts?
alex



From: Paul Shapiro on
You could try adding Application.DoEvents after your code assigns the text
values. That forces the UI events to be processed. Otherwise Access
schedules the UI events in and among the computational work.

"alex" <sql_aid(a)yahoo.com> wrote in message
news:7ab3123f-5386-4749-a9f0-2a7b96337caa(a)32g2000prq.googlegroups.com...
> Refresh unbound textbox
> Using Access �03�
>
> I have quite a bit of VBA code that runs a variety of queries.
> Between all of the SQL code, I display information to the user in an
> unbound textbox on the form. Something like this:
> �������������������������
> Sub RunQueries()
> Me.unboundTextBox = �About to run queries�
>
> Me.unboundTextBox = �Running Query A�
> Docmd.runsql(queryA)
>
> Me.unboundTexBox = �Running Query B�
> Docmd.runsql(queryB)
>
> �
>
> Me.unbountTextBox = �Running Query Z�
> Docmd.runsql(queryZ)
>
> Me.unboundTextBox = �Finished queries�
> End sub
> ����������������������������
>
> The problem is that (on some occasions) the queries will run without
> the text being displayed; i.e., the textbox will display �About to run
> queries� and then will display �Finished queries.� I thought the
> problem was that the queries ran so fast, I just couldn�t see the
> textbox change, but this happens even when it takes a few moments for
> the queries to finish. E.g., I can see the queries running in the
> lower left-hand status bar, but the text will not change.
>
> It�s almost like I need to put in a break (like a msgbox) to get the
> textbox to refresh�which works strangely enough? Or possibly to set
> the focus back to form/textbox?
>
> Any thoughts?
> alex

From: Daryl S on
Alex -

Add a Me.Repaint in the code after each textbox update.

--
Daryl S


"alex" wrote:

> Refresh unbound textbox
>
> Hello,
>
> Using Access '03…
>
> I have quite a bit of VBA code that runs a variety of queries.
> Between all of the SQL code, I display information to the user in an
> unbound textbox on the form. Something like this:
> '''''''''''''''''''''''''
> Sub RunQueries()
> Me.unboundTextBox = “About to run queries”
>
> Me.unboundTextBox = “Running Query A”
> Docmd.runsql(queryA)
>
> Me.unboundTexBox = “Running Query B”
> Docmd.runsql(queryB)
>
> …
>
> Me.unbountTextBox = “Running Query Z”
> Docmd.runsql(queryZ)
>
> Me.unboundTextBox = “Finished queries”
> End sub
> ''''''''''''''''''''''''''''
>
> The problem is that (on some occasions) the queries will run without
> the text being displayed; i.e., the textbox will display “About to run
> queries” and then will display “Finished queries.” I thought the
> problem was that the queries ran so fast, I just couldn't see the
> textbox change, but this happens even when it takes a few moments for
> the queries to finish. E.g., I can see the queries running in the
> lower left-hand status bar, but the text will not change.
>
> It's almost like I need to put in a break (like a msgbox) to get the
> textbox to refresh—which works strangely enough? Or possibly to set
> the focus back to form/textbox?
>
> Any thoughts?
> alex
> .
>