If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Can procedures run simultaneously?
Hello,
I have got the following problem. When some user clicks on the command-button placed on my form the time-consuming operation starts to run. That is why I want to display some information text in some caption or text box which would change by every let's say second. I have written this timer procedu Sub Info() Me.Text1.Caption = " . . .Proceeding . . ." Me.Text2.Caption = ". . . Proceeding. . . " End Sub Sub Form_Timer() Me.Text1.Visible = Not Me.Text1.Visible Me.Text2.Visible = Not Me.Text1.Visible End Sub I donīt want to use status bar. The problem is that the timer event procedure and the button_click procedure donīt run simultaneously. I tried to use 2 forms but the result was the same. Can someone tell me what to do? Thanks, Milan |
#2
|
|||
|
|||
Can procedures run simultaneously?
Hi Milan,
AFAIK there is no real way to have simultaneous procedures. However you can design your procedure in such a way that you can display status messages to the screen. First off, it really depends on what you are doing that takes a long time to run. If it is a long running query then I don't think theres much you can do because Access won't yield any CPU time to allow you to get messages written or displayed to the screen. If you have multiple queries or steps then the key to updating the screen is to use the "DoEvents" command to tell Access/VBA to yield a little CPU time to handle lower priority tasks such as updating the display. You would need to embed this in the code that is taking up the CPU time (ie your command button click event). Let's say that your click event contains some sort of loop: for i = 1 to 100000 ' 'do your real stuff ' Me.Text1.Caption = " . . .Proceeding . . ." Me.Text1.Visible = Not Me.Text1.Visible doevents next i This is going to flash very quickly and it is also taking CPU time away from the real processing so I would recommend putting in a second counter to only flash the status on every Nth iteration: Dim i As Integer Dim j As Integer For i = 1 To 10000 ' 'do your real stuff ' 'second counter j = j + 1 If j = 30 Then Me.Text1.Caption = " . . .Proceeding . . ." Me.Text1.Visible = Not Me.Text1.Visible DoEvents j = 0 End If Next i Another way of doing this uses the Mod statement (look at help on this): Private Sub Command13_Click() Dim i As Integer Dim j As Integer For i = 1 To 10000 ' 'do your real stuff ' If i Mod 30 = 0 Then Me.Text1.Caption = " . . .Proceeding . . ." Me.Text1.Visible = Not Me.Text1.Visible DoEvents End If Next i End Sub Now, having said all this you can look at my website http://www.daiglenet.com/MSAccess.htm and check out the progress meter examples. -- Sandra Daigle [Microsoft Access MVP] Please post all replies to the newsgroup. Milan wrote: Hello, I have got the following problem. When some user clicks on the command-button placed on my form the time-consuming operation starts to run. That is why I want to display some information text in some caption or text box which would change by every let's say second. I have written this timer procedu Sub Info() Me.Text1.Caption = " . . .Proceeding . . ." Me.Text2.Caption = ". . . Proceeding. . . " End Sub Sub Form_Timer() Me.Text1.Visible = Not Me.Text1.Visible Me.Text2.Visible = Not Me.Text1.Visible End Sub I donīt want to use status bar. The problem is that the timer event procedure and the button_click procedure donīt run simultaneously. I tried to use 2 forms but the result was the same. Can someone tell me what to do? Thanks, Milan |
#3
|
|||
|
|||
Can procedures run simultaneously?
Sandra's comments can't be beat. That is real classic computer stuff "mod"
and loops! (brings me back to my old apple II days!). I do however have a nice progress bar that DOES run independently of your code..and can update all by its self. Try downloading my super easy word merge. You can try sing the word merge to see how the progress bar works, and there is also a sample on the form to test the progress bar. You will find that word merge with the sample progress bar he http://www.attcanada.net/~kallal.msn.../msaccess.html -- Albert D. Kallal (Access MVP) Edmonton, Alberta Canada http://www.attcanada.net/~kallal.msn |
#4
|
|||
|
|||
Can procedures run simultaneously?
Dear users,
thank you very much for your answers. Milan |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Scheduling Procedures With OnTime | mowen | General Discussion | 3 | June 22nd, 2004 12:06 AM |
MS Access 2000 and SQL Server Stored Procedures | Tony | General Discussion | 0 | June 11th, 2004 12:27 AM |
How can we view multiple peoples schedules on a calendar simultaneously? | Lisa | Calendar | 1 | May 20th, 2004 05:04 PM |
Installation procedures | Ray | Setup, Installing & Configuration | 0 | May 6th, 2004 03:54 PM |
scroll two documents simultaneously | macnutt | Visio | 1 | May 5th, 2004 11:16 PM |