Dear friends,
I have a command button that when clicked, runs tens of queries, millions of calculations, etc.
This process takes about 10 seconds each time, and the mouse pointer rapidly changes into hourglass and changes back to pointer during this process.
If the user opens other forms or does other things while the main calculations are not finished yet, the results would be disaster. So I want to disarm the user by disabling mouse and keyboard before starting calculations, and re-enable them after finishing the calculations.
Possible???????????????
18 16775
Making the form with the command button Modal would prevent other windows from being opened. Just disable other controls on that one form until the operations are complete.
some of the calculations are done after the form is closed, and no form is open.
I need a more """""""reliable"""""""" way!!!!
Why do you close the form if you don't want the user doing anything? Just display a message saying Please Wait, or a progress bar, or something.
NeoPa 32,556
Expert Mod 16PB
Keep the form open (invisible if you prefer) and handle any events that may fire.
In essense, the code that has already been invoked should run through without interruption anyway.
Keyboard and mouse events should be queued to run later if code is already executing.
So I want to disarm the user by disabling mouse and keyboard before starting calculations, and re-enable them after finishing the calculations
I wouldn't think this is a good idea. User could not do something else, like check email. Also, if something goes wrong, computer is effectively locked, and must be rebooted, causing loss in any other open programs.
I have a command button that when clicked, runs tens of queries, millions of calculations, etc.
This sounds as if the results of calculations are stored in tables, and not re-calculated 'on-the-fly'. Without more information, we don't know if this is appropriate.
If this button opened a New Form as modal, this new form could have a status bar and/or "Please Wait". It might also have a "Cancel" button if cancelling is possible. This form would be closed on completion. This would allow the user to change programs, but not continue to work in the current program while the
tens of queries, millions of calculations
are being executed.
Warning, if another Access program uses the same tables, they would still be accessable to the user with any of the proposed solutions in this thread. The issues raised in the original post will then need to be addressed.
@Alireza355
Very possible. I know that I will probably raise a few eyebrows on this one, but I can actually see the need to Block Keyboard and Mouse Input during intensive operations in order to maintain a sort of System Modality. This is only acceptable, at least to me, if there is some kind of visual cue for the User indicating this Inactive Input State, in this case the 'Olde Hourglass'. In any event, here it goes: - Declare the following API Function:
- Public Declare Function BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long) As Long
- Write Code 'similar to' the following. I would strongly assume writing the Code within the context of an Error Trap to Unblock Input and also to turn the Hourglass OFF shound an Error occur:
- Private Sub ImpData_Click()
-
On Error GoTo Err_ImpData_Click
-
Dim intCounter As Long
-
-
DoCmd.Hourglass True
-
-
BlockInput True
-
-
For intCounter = 1 To 2147000000
-
'take a nap!
-
Next
-
-
BlockInput False
-
-
DoCmd.Hourglass False
-
-
Exit_ImpData_Click:
-
Exit Sub
-
-
Err_ImpData_Click:
-
BlockInput False: DoCmd.Hourglass False
-
MsgBox Err.Description, vbExclamation, "Error in Pic Names"
-
Resume Exit_ImpData_Click
-
End Sub
- BTW, there is an Escape Route, ALT + CTRL + DEL will effectively Disable Input Blocking.
- Good Luck, and let us know how you make out should you attempt this controversial approach.
NeoPa 32,556
Expert Mod 16PB @ADezii
I just should'a known you'd 'a known :D
We won't talk about the potential for dodginess here. I'm just impressed you would know such an apposite answer.
@NeoPa
I also knew that the 1st eyebrow to be raised would be yours (LOL)!
NeoPa 32,556
Expert Mod 16PB
My judgement was that it was definitely worth posting. Eyebrows firmly settled ;)
@NeoPa
BTW, what Degree of dodginess am I (1, 2, or 3)? dodg·y (dj)
adj. dodg·i·er, dodg·i·est Chiefly British - Evasive; shifty.
- Unsound, unstable, and unreliable.
- So risky as to require very deft handling
NeoPa 32,556
Expert Mod 16PB
Not you ADezii.
The potential is for the information you make available to be misused.
Obviously, you're well dodgy, but that's not the point :D
Thank you all, specially ADezii
Thank you so much.
@Alireza355
You are quite welcome. Be careful in the use of this code, and ' always' provide a mechanism for enabling Keyboard/Mouse Input once again should an Error occur midstream. Good Luck, and let us know how it all works out.
NeoPa 32,556
Expert Mod 16PB
That's always good advice ADezii, but from Fish's link it will recover itself on any unhandled crash and a Ctrl-Alt_Del always gives any operator the power to cancel this effect. This even reduces the dodginess factor :D
@NeoPa
This even reduces the dodginess factor
Does that mean that the code has been Dedoged? (LOL)
NeoPa 32,556
Expert Mod 16PB
Entirely? No. Predominantly though? Yes.
PS. Just because you see there are so many 'D's in the word is no excuse to leave one out. Is four 'D's too much for a single word? Probably yes.
Still should be De-dodged :D
@NeoPa
I stand corrected-ed! (LOL)!
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Michael J Whitmore |
last post by:
Greetings,
I have a very simple question. How do you simulate a user input to
turn off a screen saver in Windows (either a mouse movement, mouse
click, or keyboard input)? I promise I searched...
|
by: Alejandro Sánchez Acosta |
last post by:
Hello,
I have done a little aplication that does a remote connection to other machine
and opens a vncclient to connect to the VNC in other machine (it's just for a
network monitorization).
...
|
by: H.Bierhuizen |
last post by:
Hello,
Does anyone know how to disable the mouse on a specific form? So users are
only allowed to use keyboard controls.
Thanks already for answering.
Hans
...
|
by: zalph |
last post by:
1- Is it possible to disable the keyboard print screen...
2- ... in javascript? If so, how?
|
by: mkaszub |
last post by:
Hi,
I have a problem with combobox. On my form is many comboboxes and when I select same option and use my mouse roll, combobox change to next value. How to disable mouse roller? I tried to...
|
by: Boki |
last post by:
Hi All,
We can process the mouse/keyboard events by handling, however, how to
create a event on a target form ( ex: webbrowser ) ?
Thanks!
Best regards,
Boki.
|
by: skip |
last post by:
Sorry to bomb this list with an off-topic post, however... Ages ago I wrote
a mouse/keyboard watcher in Python+Tk: http://sf.net/projects/watch. It's
been idle for a long while though, isn't...
|
by: =?Utf-8?B?TXJOb2JvZHk=?= |
last post by:
I want to do something similar to what some macro tools do, where they
perform mouse/keyboard events on the user's machine , while intercepting the
user's current keyboard/mouse events so that it...
|
by: selvakumari |
last post by:
Hi,
i am new to C#,
i have a multiselection treeview, where if i select a nodes with ctrl and shift corresponding nodes will be copied to another treenode,
i want to unselect the...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |