Microsoft Developer Network >
Forums Home
>
Microsoft ISV Community Center Forums
>
Visual Basic for Applications (VBA)
>
Help with Progress Bar - getting error 7952 (acSysCmdUpdateMeter)
Help with Progress Bar - getting error 7952 (acSysCmdUpdateMeter)
- Hi All,
I have an access app and I'm trying to incorporate a progress bar as a function loops through a query recordset.
I'm able to initiate the progress bar by:
syscmd acSysCmdInitMeter, message, total#
but when I try to increment the progress bar:
syscmd acSysCmdUpdateMeter, progress#
I get error: '7952 You made an illegal function call'
Any ideas how to fix this?
Thank you!
All Replies
- Hi Condor,
here you can find a working example, http://support.microsoft.com/kb/210474/en-us
Wich Access version are you using?
Cinzia
Sito RIO
Il mio Blog Thank you Cinzia!
The example helps. However, I'm still experiencing the same issue. I'm using Access 2007.
Here's a sample of my code:When it tryes to increment the Progress Bar the Error mentioned before gets thrown. :(Set rst = CurrentDb.OpenRecordset("tbl_table1") Count = rst.RecordCount Progress_Amount = 100 / Count If rst.RecordCount <> 0 Then rst.MoveFirst Do Until rst.EOF If rst![Show] = "True" Then ... rst.MoveNext End If RetVal = SysCmd(acSysCmdUpdateMeter, Progress_Amount) Loop End If CurrentDb.Close rst.Close Set rst = Nothing<br/>
Any thoughts? Thank you so much!!!- Hi,
Progress_Amount must be an integer type and must be an increasing number for each cycle.
Try this way:
Set rst = CurrentDb.OpenRecordset("tbl_table1") rst.MoveLast count= rst.RecordCount Progress_Amount = 1 retval = SysCmd(acSysCmdInitMeter, "Reading Data...", count) If rst.RecordCount <> 0 Then rst.MoveFirst Do Until rst.EOF If rst![show] Then rst.MoveNext End If retval = SysCmd(acSysCmdUpdateMeter, Progress_Amount) Progress_Amount = Progress_Amount + 1 Loop End If rst.Close Set rst = Nothing
Cinzia
Sito RIO
Il mio Blog - Thank you Cinzia! I tried your example but I still get the same error
Run-time error '7952':
You made an illegal function call.
This gets thrown the first time trying to execute
retval = SysCmd(acSysCmdUpdateMeter, Progress_Amount)
Any thoughts as to why this is happening?
I'm declaring the following:
Thank you!Dim Count As Integer Dim Progress_Amount As Integer Dim RetVal As Variant
- Cinzia,
Here's some interesting information, I just tried the following before I ran the recordset:
And it worked OK. However, when I incorporate the exact same from above into the recordset, I get the same error. ?!? I'm confused.SysCmd acSysCmdInitMeter, "Hello", 200 SysCmd acSysCmdUpdateMeter, 100 SysCmd acSysCmdClearStatus - Hi,
I'm confused too!
Can you follow the cycle on recordset step by step with F8 to see if the error is on
SysCmd acSysCmdUpdateMeter, 100, if it happens on first cycle, or after X cycle or if there is
something else that go in error?
Can you post the exact code you have used for the test?
Cinzia
Sito RIO
Il mio Blog - Hi Cinzia,
Just want to say THANK YOU for your help thus far! :)
I think I know the source of my error. Besides recordset1, I have 3 addtional recordsets. I tried the code again with only one recordset and it worked as expected. However, I need to incorporate the progress bar into my code. Let me give you an example of my code:
Dim rst As Recordset Dim rst2 As Recordset Dim rst3 As Recordset Dim rst4 As Recordset Dim OID As Integer Dim Count As Integer Dim Progress_Amount As Integer Dim test As Integer<br/> Set rst = CurrentDb.OpenRecordset("tbl_table1") Set rst2 = CurrentDb.OpenRecordset("tbl_table2") Set rst3 = CurrentDb.OpenRecordset("tbl_table3") Set rst4 = CurrentDb.OpenRecordset("tbl_table4") rst.MoveLast Count = rst.RecordCount Progress_Amount = 1 '**********Initialize the progress meter.************************* SysCmd acSysCmdInitMeter, "Test Message!!!", Count '***************************************************************** If rst.RecordCount <> 0 Then rst.MoveFirst Do Until rst.EOF If rst![Show] = "True" Then '*********Incrementing Progress Bar *********************** test = rst.AbsolutePosition If test >= 1 Then Progress_Amount = Progress_Amount + 1 SysCmd acSysCmdUpdateMeter, Progress_Amount '********************************************************** rst2.MoveNext rst2.AddNew ID = rst![ID] rst2.Edit rst2![OID] = ID rst2.Update rst3.AddNew rst3![OID] = ID rst3.Update rst4.AddNew rst4![OID] = ID rst4.Update rst.Edit rst![Show] = "False" rst.Update rst.MoveNext End If OID = 0 Loop End If CurrentDb.Close rst.Close Set rst = Nothing rst2.Close Set rst2 = Nothing rst3.Close Set rst3 = Nothing rst4.Close Set rst4 = Nothing
The first loop runs OK but when the 2nd loop happens it errors when it tries the progress bar gets incremented. Trying to understand why it errors out when more than one recordsets are incorporated.
Thank you Cinzia! - Hi Condor,
it's really a nightmare! :-)
I see nothing wrong in your posted code!
May you made a little accdb that reproduce the problem, and put it somewhere, so I can download it and test?
Cinzia
Sito RIO
Il mio Blog - Cinzia,
Thank you so much for your help! I finally found the cause of my error. I had another SysCmd command: acSysCmdSetStatus. This was the culprid! After I removed it the code functioned as expected!
Again thank you!!!!

