473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Screen Refresh

I am doing a import of a file in to access. I have a form that is
updated for every record and every file that is imported. I would
like to be able to start and stop the process. However when I start
the process I am unable to stop it. All controls to the form are
lost. I think when I make the call to do the import module the
function will not continue till the module it called has finished
running. Is there a way to tell it to run this function but dont wait
for it to finish?
Thanks for you help,
Kirk
Nov 13 '05 #1
1 2602
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

There is only one thread running during VBA execution. So,...

In the called function use he DoEvents command. It will temporarily
stop the running code & allow other objects to raise an event.

It sounds like your called function is looping so try something like
this:

Set up a global variable in a standard module:

Public blnStopFunction As Boolean
==================

In the called function's loop do something like this:

Do While Not Eof(#inputFile)
..... file handling stuff
DoEvents
' Did user click the stop button
If blnStopFunction = True Then Exit Do
Loop

If blnStopFunction Then ... clean up open file then exit function

===============

On the form that calls the function, have a button, "Cancel," that sets
the blnStopFunction variable = True. When the DoEvents runs in the
called function loop, the click on the Cancel button will set the
blnStopFunction. The blnStopFunction check in the loop will determine
if the Cancel button has been clicked & if the routine should continue.
Be sure to clean up the file handling before returning to the calling
code (close the file, etc.).

Have some code in the calling code that will also check to see if the
called function completed or was cancelled - just check blnStopFunction
to see if it is True. Be sure to re-set to False afterward (so you can
call the function again w/o premature cancellation. Better yet, set the
variable to False before the initial call to the file handling function.

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQSaKfIechKqOuFEgEQKChQCgy7g+Gcaeh7mFWMfFwOViQC uOiKQAoK2g
1EtLg77asvHnOFOph0u+YxRx
=0OcL
-----END PGP SIGNATURE-----
Kirk wrote:
I am doing a import of a file in to access. I have a form that is
updated for every record and every file that is imported. I would
like to be able to start and stop the process. However when I start
the process I am unable to stop it. All controls to the form are
lost. I think when I make the call to do the import module the
function will not continue till the module it called has finished
running. Is there a way to tell it to run this function but dont wait
for it to finish?


Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: AK | last post by:
Hi, I have a medium sized app that I'm transferring to use curses. What happens is very very strange.. I am at my wits' ends. I worked with it all day yesterday and couldn't figure it out....
6
by: Logger | last post by:
Help, Want someone's option. I'm calling a popup screen, say form B, to add/edit a record. In, say form A, I call form B using javascript window.open in server side code. I need to know when I...
0
by: jimvn | last post by:
while my screen saver (webshots) is active, my vb.net windows app updates a textbox. after exiting the password protected screen saver, the text box does not appear to be updated, but it has been,...
3
by: John Baker | last post by:
Hi: As in the "Wizard of Oz", I want people to "pay no attention to the man behind the curtain", by freezing the screen while a whole lot of things happen. I know about ECHO OFF, but this...
3
by: serge anton | last post by:
Hi, I want to refresh all the screen (including the desktop) or a part of the screen. I can have a reference to the screen with win32 API : public static extern int GetWindowDC(IntPtr...
3
by: redneon | last post by:
Is an event fired whenever there's a screen refresh? I'm wanting to run a certain method whenever there's a screen refresh and was wondering if I could override wndproc and listen for an event to...
1
by: Sachin Kuchinad | last post by:
Hi, I am using Smart Navigation to avoid screen flashes during refresh / reload of web pages which are under frames. Following is the physical layout of pages and their attributes. Main.aspx...
4
by: | last post by:
I'm not sure what to think of this. In the appliacation, upon postback, users screens will get mixed up. Meaning... Perhaps on my screen im working with a particular set of data. I click a button...
0
by: Casey Bralla | last post by:
For some reason, I can't get curses to refresh the screen. Can someone offer a suggestion to try to debug this? Here is my python code snippet: stdscr=curses.initscr() curses.noecho()...
0
by: Casey Bralla | last post by:
My problem was caused by a getch() function which paused, waiting for the character. Live and learn. <sigh> For some reason, I can't get curses to refresh the screen. Can someone offer a...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.