Access2007-Running Counter

F

FKChong

I want to display a running counter on the screen so that the user know that
the program is running and not hang as well as how records have processed. I
use to able to apply the following code in Acees 2003 but not in Access
2007.

Is any one know the reason ? Do you have the Access 2007 code for display
running counter on screen ?


Private Declare Function GetFocus Lib "user32" () As Long

Private Declare Function SetWindowText Lib "user32" Alias
"SetWindowTextA" (ByVal Hwnd _
As Long, ByVal lpString As String) As Long


Private Sub Text0_Click()
Dim a As Long
Dim Hwnd As Long
Dim lngResult As Long
Dim strTest As String

' Get the window handle for the current window.
' That's this TextBox's Window
Hwnd = GetFocus()

Debug.Print Now
'DoEvents
For a = 0 To 10000 Step 1
'Me.Text0 = a
'Me.Repaint
'DoEvents
' Send the message to the current text box
' Updates the TEXT property
lngResult = SetWindowText(Hwnd, a)

Next a

Debug.Print Now
End Sub
 
T

Tom van Stiphout

On Thu, 22 Jan 2009 11:42:03 +0800, "FKChong" <[email protected]>
wrote:

Rather than using Windows API wizardry, why not rely on the built-in
SysCmd method? It's probably more likely to be supported.

-Tom.
Microsoft Access MVP
 
T

Tom van Stiphout

On Thu, 22 Jan 2009 11:42:03 +0800, "FKChong" <[email protected]>
wrote:

Rather than resorting to Windows APIs you can simply use the built-in
SysCmd method. It's probably more likely to continue to work.

-Tom.
Microsoft Access MVP
 
F

FKChong

Thanks, Tom.

I found sample code on SysCmd , It's work on Access 2007. However is there a
way to display the number of record being process. For eg. Total Record is
200. When proceesing record no. one, display "1 of 200" on screen. When
proceesing record no. two, display "2 of 200" on screen and so on.
 
F

FKChong

Thanks, Tom.

I found sample code on SysCmd , It's work on Access 2007. However is there a
way to display the number of record being process. For eg. Total Record is
200. When proceesing record no. one, display "1 of 200" on screen. When
proceesing record no. two, display "2 of 200" on screen and so on.
 
T

Tom van Stiphout

In your call with acSysCmdInitMeter you can send text such as
"Processing 200 records". As the progress bar fills, the rest is left
to the user's imagination.

-Tom.
Microsoft Access MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top