Access VBA - Application.StatusBar?

HedgePig

Board Regular
Joined
Jun 27, 2002
Messages
146
I have some VBA code that takes a while to run and want to display some sort of message giving an indication of progress.
In Excel VBA I would use simply do something like
Code:
Application.StatusBar = "Processing File " & filenamestr

However Access 2002 doesn't appear to support this. Is there anything simple I can use to display a message that while the program continues running?

Regards
HedgePig
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Hi

There is a function to change the status bar text while running VBA code - but it depends on which button / control last had the focus before the code ran. For example, if the user clicked a button called 'cmdRun' then you could add this line of code to the start of the VBA code:

Me.cmdRun.StatusBarText = "Please wait...."

HTH, Andrew
 
Upvote 0
I came across a Status routine that I use in my apps.
Code:
Sub Status(pstrStatus As String)
    
    Dim lvarStatus As Variant
    
    If pstrStatus = "" Then
        lvarStatus = SysCmd(acSysCmdClearStatus)
    Else
        lvarStatus = SysCmd(acSysCmdSetStatus, pstrStatus)
    End If
    
End Sub
To use, you could have Status("Processing Record " & lngRecNo)

at the end, use Status("") to clear the status bar.

Denis
 
Upvote 0
Ha! That's exactly what I wanted SydneyGeek. Many thanks.

HedgePig

P.S. Andrew, thanks for the reply but i'm not using any buttons, so I'll stick with Sg's suggestions.
 
Upvote 0
I have this function (it is a function, as I believe you can only call functions from macros) that is to update the status bar that I run between steps of a macro. However, it isn't working. During the running of the macro, I only see my last status bar after the macro has finished running.

Function StatusBar(Optional varQuery As Variant)
Dim Stat As Variant
If Not IsMissing(varQuery) Then
If varQuery <> "" Then
Stat = SysCmd(acSysCmdSetStatus, "Query Running: " & varQuery)
Else
Stat = SysCmd(acSysCmdClearStatus)
End If
Else
Stat = SysCmd(acSysCmdClearStatus)
End If
End Function

My only idea is that I set Echo and SetWarnings to NO at beginning of macro and set them to YES at end. But I sent them to yes *after* my last status bar update, and that status bar message still displays.

After looking, I now wonder why I don't use the ECHO function, since it seems to have a "Status Bar Text" field.

Doc²
 
Upvote 0
That actually didn't work. I suspect it is because my macro is running queries, so each step has the "Running Query" status bar (on the right hand side of screen). I'm assuming that takes precedence over my status bar function. Any idea if that is true? And if it is, how to split the status bar? I did notice when I use my function, the status bar does have a | in the center of it, so it looks split.
 
Upvote 0

Forum statistics

Threads
1,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top