473,803 Members | 3,431 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Time During Query

blyxx86
256 Contributor
I have created a form that keeps record of a few queries that are ran. One set of queries takes 30 minutes to pull the information. The other takes about 6 minutes.

I managed to use two variables to store the time before and after the queries are finished.

However, I am trying to have a textbox on one of the forms count up (one second at a time) to show the elapsed time. I've tried setting up an 'OnTimer' event with TimerInterval = 1000

I'm handwriting all of this as it's on another station currently...
The form functions when a query is not running.

SetTimeFormat is a function I found through this website or Google that converts a number to Minutes:Seconds or Hours:Minutes

It seems like the OnTimer event stops running when a query is running?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.  
  3. Dim dblElapsed As Double
  4.    Me.Repaint
  5.    dblElapsed =  DateDiff("s","" & Me.txtStart & "", "" & Time() & "")
  6.    Me.Repaint
  7.    Me.txtElapsed = SetTimeFormat(dblElapsed)
  8.    Me.Repaint
  9. End Sub
  10.  
Aug 16 '07 #1
3 2797
FishVal
2,653 Recognized Expert Specialist
I have created a form that keeps record of a few queries that are ran. One set of queries takes 30 minutes to pull the information. The other takes about 6 minutes.

I managed to use two variables to store the time before and after the queries are finished.

However, I am trying to have a textbox on one of the forms count up (one second at a time) to show the elapsed time. I've tried setting up an 'OnTimer' event with TimerInterval = 1000

I'm handwriting all of this as it's on another station currently...
The form functions when a query is not running.

SetTimeFormat is a function I found through this website or Google that converts a number to Minutes:Seconds or Hours:Minutes

It seems like the OnTimer event stops running when a query is running?

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Timer()
  2.  
  3. Dim dblElapsed As Double
  4.    Me.Repaint
  5.    dblElapsed =  DateDiff("s","" & Me.txtStart & "", "" & Time() & "")
  6.    Me.Repaint
  7.    Me.txtElapsed = SetTimeFormat(dblElapsed)
  8.    Me.Repaint
  9. End Sub
  10.  
Hi, blyxx.
You are right no timer event in form will be triggered while query is running.
I'm not sure whether it will work, but you may use Win timers to handle it.
Maximum it will crash your system. ;) Make backup first.

In the form module (I guess) before query runs.
Expand|Select|Wrap|Line Numbers
  1. Dim lngTimerID As Long 'global var to store TimerID to kill it further
  2.  
  3. Private Sub btnRunQuery_Click()
  4.     ............
  5.     'set 1000 ms system timer
  6.     lngTimerID = SetTimer(Me.hwnd, 0, 1000, AddressOf TimerProc)
  7.  
  8. End Sub
  9.  
  10. Private Sub Form_Close()
  11.     KillTimer Me.hwnd, lngTimerID
  12. End Sub
  13.  
In a public module
Expand|Select|Wrap|Line Numbers
  1. Public Declare Function SetTimer Lib "user32" _
  2.      (ByVal hwnd As Long, ByVal uTimerID As Long, ByVal uInterval As Long, _
  3.      ByVal fpCallback As Long) As Long
  4.  
  5. Public Declare Function KillTimer Lib "user32" _
  6.     (ByVal hwnd As Long, ByVal uTimerID As Long) As Boolean
  7.  
  8.  
  9. Public Sub TimerProc(ByVal hwnd As Long, ByVal uMsg As Long, _
  10.     ByVal uEvent As Long, ByVal dwTime As Long)
  11.  
  12.     On Error Resume Next
  13.     Forms!Form1!txtTime = Now
  14. End Sub
  15.  
at least with MsgBox active (you know, this blocks events too) it runs perfectly.
Aug 16 '07 #2
FishVal
2,653 Recognized Expert Specialist
BTW take look at this.
TheScripts Tip of the Week #24 - ADO Events [Advanced Content]
Aug 16 '07 #3
blyxx86
256 Contributor
I will give this a shot. Thank you. :)
Aug 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
4268
by: Keith Bussey | last post by:
Hello all, After changing RAM and the ethernet card of my DB server, the problem of getting frequent: Database error (error code 102) Could not connect to database server (Lost connection to MySQL server during query) Still occurs ;/
0
2271
by: Jim the Bad | last post by:
Hi, I wonder if anyone can help me with this. Bog standard SuSE 8.2 Linux install. I have installed mySQL (off the SuSE 8.2 distro CDs). I can connect locally, e.g: bealzebub> mysql -u root -p mysql -h localhost ....logs me in just fine. However, this:
0
1688
by: Ville Rontti | last post by:
Hi I have following problem: when I try to connect from Windows XP to mysql server (linux computer), I get the following error: Lost connection to mysql server during query. This happens when I test the connection. I have firewall in linux, so I opened the port 3306. Is there something else I need to change to make sure that the connection will work properly? Ville Rontti
0
5802
by: Mike Chirico | last post by:
With mysql-4.1.1-alpha, using any User Defined Function ( UDF) at the query execution stage, on Linux 2.6, gave me the following error: "ERROR 2013 (HY000): Lost connection to MySQL server during query" However, upgrading to mysql-4.1.2-alpha seemed to solve the problem. Both versions were configured exactly as follows ../configure --with-openssl --enable-thread-safe-client --with-mysqld-ldflags
0
1665
by: piablo | last post by:
Hi all, I have an unusual problem with the error "Lost connection to MySQL sever during query". I receive this message only when querying one table in a database. All other tables and queries work fine. Any ideas of the cause would be appreciated. If I figure it out beforehand, I'll post a resolution. TIA
0
2578
by: Diamondback | last post by:
I have MySQL 4.1.10 running successfully on an office XP machine, but when I try to set up similar XP box at home I continually get this error: "Error 2013: Lost connection to MySQL server during query". The install went fine, and Windows XP is recognizing it as a running service. But whenever I try to connect via one of my GUI applications (e.g., MySQLFront), the error appears. I have scoured this forum and Google looking for this...
1
9866
by: furqonk | last post by:
I have query like below: SELECT part_no,part_nm,qty FROM tb_stok_out ORDER BY part_no as result: part_no part_nm qty aaa asdfd 3 abab sdfsdf 4 abab adfdf 5
3
3911
by: camarun20 | last post by:
Hi , I constructed an MS access query in java to retrieve the rows in random. The code snipet Connection con = DriverManager.getConnection( database ,"",""); Statement s = con.createStatement() strQry = "select top 10 S_No , Rnd(S_No) as exp from Questions order by Rnd(S_No) desc" ; s.execute(strQry) ;
1
5398
by: theschaef | last post by:
Hi there. I am using perl to connect to a database and then pull the rows off of the table one by one to manipulate the data. If I use a smaller table (~8 MB), I wait for around 20 seconds but then the table values are read just fine. However if I use a larger table (~30 MB), I wait for a while and then I get the message: DBD::mysql::st execute failed: Lost connection to MySQL server during query I have tried searching for the...
0
10548
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10295
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9125
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7604
isladogs
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6842
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5500
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4275
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.