เขียนโปรแกรมแสดง Status bar ใน Access

Post date: Aug 23, 2013 3:29:58 AM

First you will need to declare a Variant:

Dim varStatus As Variant

You might also want to declare a String for any text you would like to display:

Dim strStatus As String

You then use this variant to assign any message to the Status bar with the acSysCmdSetStatus action of the SysCmd function, like so:

strStatus = “The database is searching for the most recent file…”

varStatus = SysCmd(acSysCmdSetStatus, strStatus)

You can also display a progress meter with the acSysCmdInitMeter action, like so:

strStatus = “Importing four XLS files”

varStatus = SysCmd(acSysCmdInitMeter, strStatus, 21)

The value 21 (identified as [Argument3]) determines the 100% value

(There are 20 blocks in the progress meter, but the meter starts with one already filled in, so 21 is an easy value to use, unless you want to use 100 and true percentages values.)

The meter is updated whenever the acSysCmdUpdateMeter action is used, like so:

varStatus = SysCmd(acSysCmdUpdateMeter, 5)

The value 5 represents the amount of the progress meter to fill in. So here, 5 will fill in 5 blocks, 25% of the progress meter.

Once you have filled in the progress meter (or at any stage) you can either display another text statement, or another progress meter, but if you have finished you must remember to clear the Status bar with the acSysCmdClearStatus action, like so:

varStatus = SysCmd(acSysCmdClearStatus)

ขอบคุณแหล่งข้อมูล http://www.tek-tips.com/faqs.cfm?fid=1851