Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access VBA
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 23rd, 2005, 11:41 AM
Authorized User
 
Join Date: Jan 2005
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default Prevent Multiple click of cmd button until code ex

Hello,
I have a command button that reads data from my scale, this process takes about 2 seconds so I would like to make it that the user cannot accidently click the button again until the code finishes executing or else it will give an error. I know that it does not allow the disable a button when u press it is there any way of doing this?

Thanks

 
Old February 23rd, 2005, 12:38 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

Have the button open another form and make it modal. Put a message on the form to wait a second, and put a timer on the form to close it after 2 seconds. This will prevent them from doing anything in Access until the modal form closes.

mmcdonal
 
Old February 25th, 2005, 06:46 AM
Friend of Wrox
 
Join Date: Nov 2004
Posts: 248
Thanks: 0
Thanked 1 Time in 1 Post
Default

Another option would be to set a form level variable...

On the form (General) (Declarations)..
Dim blnScaleProcessing as boolean

In Form_Load...

blnScaleProcessing = False

In cmdProcessScale_Click..

If blnScaleProcessing then
    msgbox "Error"
else
    blnScaleProcessing = True
    Call ProcessScale
    blnScaleProcessing = False
End If

QED

Randall J Weers
Membership Vice President
Pacific NorthWest Access Developers Group
http://www.pnwadg.org
 
Old February 25th, 2005, 08:58 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

How about giving the focus to another button, e.g. EXIT, then disabling the first button and re-enabling it later?

Me.cmdExit.SetFocus
Me.cmdProcess.Enable = False
'Do your processing here...
Me.cmdProcess.Enable = True
Me.cmdProcess.SetFocus


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to prevent page jumping while click on iframe' kathirnk HTML Code Clinic 0 April 16th, 2007 06:39 AM
Prevent users from using back button?? Phrozt C# 3 January 8th, 2007 11:02 AM
How to Click a web button using VB code AJD Access VBA 6 June 6th, 2006 07:32 AM
How to Click a button on a web page in VB code AJD Beginning VB 6 0 June 2nd, 2006 12:08 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.