Very Slow Update Query
Nov 21, 2007
Hi all,
I'm doing the simplest little 'INSERT INTO' type operation here with recordsets in Access 97 (SR2). Inserting into a table whose name is stored in the Const TABLE_CANDIDS.
I have a little piece of code that doesn't move on until the changes are committed to the table (usually this is just a single long integer being added).
The transaction takes up to a second to commit, and sometime doesn't commit at all. I tried putting begintrans and committrans around the loop but it seems to make the problem worse.
Can anyone spot my error?
Thanks,
Rob
' Empty the TABLE_CANDIDS table then start filling it with the current
' list of Candidates
DoCmd.RunSQL "DELETE * FROM " & TABLE_CANDIDS
Set rstCandIDs = CurrentDb.OpenRecordset(TABLE_CANDIDS)
' Find the CandIDs for all selected items (default to select all)
For Each objListItem In objListView.ListItems
If objListItem.Selected Or Not blnSelectionOnly Then
rstCandIDs.AddNew
rstCandIDs!CandIDFiltered = CLng(objListItem.Text)
rstCandIDs.Update
lngCount = lngCount + 1
End If
Next objListItem
rstCandIDs.Close
' Wait for up to 1 second until the new value(s) are committed.
Screen.MousePointer = 11
datStart = Now()
Do While IsNull(DLookup("CandIDFiltered", TABLE_CANDIDS, "CandIDFiltered <> 0"))
If DateDiff("s", datStart, Now()) > 100 Then
Exit Do
End If
DoEvents
Loop
Screen.MousePointer = 0
View Replies
ADVERTISEMENT
Feb 13, 2008
What would be a better way to do below query --
UPDATE (tblAFFIRMATION_REC_TOOL LEFT JOIN tbl_TZero_Spns ON tblAFFIRMATION_REC_TOOL.CptySPN = tbl_TZero_Spns.SPN) INNER JOIN Entity ON tblAFFIRMATION_REC_TOOL.ReferenceEntity = Entity.ReferenceEntity
SET tblAFFIRMATION_REC_TOOL.[Scope Reason] = IIf(IsNull(tbl_TZero_Spns!SPN) Or (Entity!Test='EM'),tblAFFIRMATION_REC_TOOL![Scope Reason],'TZero Trade')
WHERE ((([tblAFFIRMATION_REC_TOOL]![Scope Reason])="Affirmation Eligible"));
the way it right now, it's running for about half hour..
Could that be IIF statement that slows it down ?
View 1 Replies
View Related
Jul 27, 2005
I wonder if anyone could offer some advice on a problem with a form & subform?
I have a main form, based on table PublicationOrders:
POrderID (pk)
EventID(fk)
And a subform, EventDisplay, based on table Events:
EventID (pk)
EventName
The main form and subform are linked on the field EventID and my master and child links are correct, as far as I can tell.
The field EventID on the main form is a combobox, bound to field EventID in the table PublicationOrders. It allows the user to select which event an order is being sent to. In the Afterupdate property of this combobox, I have the code: Forms!PublicationOrders!EventDisplay.Requery
I would like the subform to update to show the details of the event that has just been selected from the combobox. However, for some reason, on afterupdate, the subform displays whichever event was selected when the previous record was entered. If I close and reopen the form, it will right itself and show the correct event information that corresponds with the order.
Any ideas why it's doing this? I have searched here for a solution but can't seem to find anything that relates.
View 2 Replies
View Related
Sep 30, 2005
I'm wondering if anyone has any idea how I can speed this form up. I have similar forms that don't calculate as much but are much faster when updating the date.
Basically, I have a make table query that pulls all units due to be delivered between a certain time period, that are a specific priority and we input how many days we want to push the delivery date back.
A form opens that shows the Job Code, Run, Door Style, Special Color, Lot Delivery Date, W/O Due Date, W/O Start Date and a Change check box. If the Change check box is selected the W/O Due Date moves back however many days entered. Based on the new W/O Due Date and whether or not a Raised Panel door or Special Color was selected the WOSD resets as well.
Here is the code I have used. It takes a little over a minute to update 1 line and we may need to move several lines. After all the units needed to move are selected, an update query is run updating the information in the actual tables used in the make table query.
Private Sub Change_Exit(Cancel As Integer)
If Me.Change = True Then
Call UpdateWODDChange
Call UpdateWOSDChange
End If
End Sub
Private Sub Form_Close()
DoCmd.OpenQuery "qryUpdateWODDPriorityChange"
DoCmd.OpenForm "frmMenu"
End Sub
Private Sub UpdateWODDChange()
Dim intNumDays As Integer
intNumDays = Forms!frmUpdateWODDbyPriority.Form.PushForwardDays
Me.WODD = AddWorkdays(Me.LotDelDate, intNumDays)
End Sub
Private Sub UpdateWOSDChange()
Dim AddColor As Boolean
Dim intNumDays As Integer
If Not (Forms!frmUpdateWODDbyPriority.Form.SpecialColor = 0) Then
AddColor = True
Else
AddColor = False
End If
Select Case Me.DoorStyle
Case "Eagle", "H/E", "F/E", "RP-9", "RP-22", "RP-23"
If AddColor Then
intNumDays = 7
Else
intNumDays = 6
End If
Case Else
If AddColor Then
intNumDays = 7
Else
intNumDays = 5
End If
End Select
Me.WOSD = MinusWorkdays(Me.WODD, intNumDays)
End Sub
View 2 Replies
View Related
Apr 16, 2013
I have a big application, which we updated to Access 2010 a month ago. It ran fine. Then we also just updated the data from 2003 to 2010. Now we have very slow searches of big tables/queries, and the tech says that 'cpu usage on the server has gone to 100%'.
What can be happening? Nothing else has been changed except that the data has been updated to 2010 accdb.
View 3 Replies
View Related
Dec 14, 2007
Hi All,
I'm having trouble with access. Basically it has been very slow to load
(over 30 seconds when not opening a database) and when opening a database it just crashes.
Has anyone any idea what could cause this as it worked fine before ?
also would a reinstall help ??
-Elfman
View 3 Replies
View Related
Sep 27, 2005
Hi,
In my database im using several union queries as they turn out to be very useful.
However, whenever I have a calculation that involves one of the union queries, things happen at a very slow pace. Is there a way to speed it up a bit?
Thank you
Stacey
View 6 Replies
View Related
Jan 19, 2008
Any ideas why a particular query would run very slow in access 2007 when it runs fine on 2003. This is running on a terminal services environment and the database connects to a ms sql 2000 server. I will try it outside terminal services when I can but I can't understand the problem. Im not talking about slightly slower its something like a factor of 100 or 200 slower (I had to limit the dataset just to get a return within a day).
The database was an access 2000 mdb for compatibility across computers but I have tried converting it with out any luck.
View 5 Replies
View Related
Aug 9, 2005
Hello,
I have the following query that I set up as a test, and it runs fine:
SELECT STATUSHISTORIE.*
FROM STATUSHISTORIE LEFT JOIN PROBLEM_DE ON STATUSHISTORIE.PROBLEM_ID = PROBLEM_DE.PROBLEMNR
WHERE (((STATUSHISTORIE.STATUSDATUM)<#1/1/2005#) AND ((PROBLEM_DE.DATENBEREICH)='SPMO') AND (((Left(([PROBLEM_DE].[MODULZUORDNUNG]),InStr([PROBLEM_DE].[MODULZUORDNUNG],"-")-2)))='K29') AND ((PROBLEM_DE.ERLSTAND)<>"WEIF"))
ORDER BY STATUSHISTORIE.PROBLEM_ID,
STATUSHISTORIE.STATUSDATUM;
I then set up two global variables ( a String and a Date) and respective functions to return them – ReturnE( ) and ReturnKW( ). Now my query looks like this, but takes ages to run:
SELECT STATUSHISTORIE.*
FROM STATUSHISTORIE LEFT JOIN PROBLEM_DE ON [STATUSHISTORIE].[PROBLEM_ID]=[ PROBLEM_DE].[PROBLEMNR]
WHERE (((STATUSHISTORIE.STATUSDATUM)<ReturnKW( ) ) AND ((PROBLEM_DE.DATENBEREICH)='SPMO') AND (((Left(([PROBLEM_DE].[MODULZUORDNUNG]),InStr([PROBLEM_DE].[MODULZUORDNUNG],"-")-2)))=ReturnE( ) ) AND ((PROBLEM_DE.ERLSTAND)<>"WEIF"))
ORDER BY [STATUSHISTORIE].[PROBLEM_ID], [STATUSHISTORIE].[STATUSDATUM];
My two public functions that return the global variables look like this:
Public gstrE As String 'global variable: contains E used for query
Public gdatKW As Date
Public Function ReturnE ()
ReturnE = gstrE
End Function
Public Function ReturnKW ()
ReturnKW = gdatKW
End Function
The tables are actually Views set up from an ODBC Data source. Can anyone please tell me why these global variables are causing the traffic jam? :)
Thanks in advance
J
View 6 Replies
View Related
Jul 27, 2006
All,
I'm not sure how well I've managed to search on this as I'm not too sure where to start!
I have an append query as follows:
INSERT INTO tbl_Employee ( Company_No )
SELECT tbl_Co_Data.Company_No
FROM tbl_Co_Data
WHERE (((tbl_Co_Data.Company_No) Not In (select Company_No from tbl_Employee)))
ORDER BY tbl_Co_Data.Company_No;
Basically this query is run a number of times a day and appends new company numbers in to a table - 'tbl_Employee'. It's badly named - it's not got much to do with employees. Any way it takes a good 3 minutes to run with about 20k records in tbl_Co_Data and probably 18k records in tbl_Employee.
It looks to me like it's looping through each record in one table for each record in the other - which is plain daft.
I'm currently experimenting with a DTS package that puts tbl_Co_Data in to SQL server first before the query would run (tbl_Employee is already there) with a view to running a SP and ditching the query.
Does anybody have any other ideas as I'm having problems with the DTS in that it appears to be pretty slow in itself!
Many thanks in advance for any response.
View 3 Replies
View Related
Feb 7, 2006
Ok my database tracks escalations through my team, I have a main table that stores the unique ID's from the other tables I use in my Combo boxes, this part works really well, no problems.
My issue is with a tableI have claled "TBL_EscJournal", this table has the following fields:
JournalID (Unique Ref, generated by autonumber)
EscID (the escalation Id that this journal is relevant to)
Journalcreator (captures name of person who as entered the journal)
JournalNotes (memo field where you enter your update)
JournalDate (Date/Time the journal was entered)
So typically when viewing the main detailed form for a particular escalation I have a subform that shows all the journal entries relevant ot that escalation.
This table is huge, about 70% the total size of my database, partly because of the number of journal entries and partly because it is a memo field and a lot of data is required sometimes.
Up until now th edatabase has been located on a local server and has been fine for local users (2-3 of us) however there is a requirement for another office to use this database.
I am now experiencing massive performance issues, whereby the data is tkaig a long time to refresh on the other sites.
I have migrated the DB over to a SQL back end but still finding performance issues, which further testing has shown that the TBL_EscJournal is the cause.
So a coupel of things really, is there another way I can layout this table to improve performance or should I be uerying the data from this tabel in another way, would it be better for me to split TBL_EscJournal in two, the first part keeping the date/time and person who entered and the second part keeping the notes. Possibly increasing the query speed by carrying out the query on the first part of the table and not on the notes (memo) part ?
I hope this makes sense, if not feel free to PM me,
Appreciate any help or assitance you could offer
MattP
View 4 Replies
View Related
Jul 9, 2015
I am trying to use a criteria to filter out nulls in concatenated variable, which slows the query considerably.The part that makes it slow looks like this -
WHERE ... AND (([tbl1].[x] & [tbl1].[y]) <> "") AND ...
If I work them individually, it's not a problem, the query is fast, but I have to combine them first in order to produce the correct output.
View 13 Replies
View Related
May 21, 2014
I have an access 2007 database connect to sql server 2008.I am running a pass though query to search between two dates (this query has been fine for years)
If I now run any search using parameters from 26th March 2014 to date - the query takes 10+ minutes to run.If I then change the date to 25th March 2014 to date - it runs in a nano second.I have not changed the back tables and I have not changed the format the data is saved in.
View 2 Replies
View Related
Jan 2, 2015
created a query (in Access 2010) that joins several linked tables (to an Oracle database). The query runs in about 20 seconds when I filter with a hard coded date (e.g., #12/31/2014#). The Oracle table column Im filtering on is defined as date/time.
When I attempt to change the hard coded value to a soft coded value (e.g., Forms![Form1]![Latest_Extract_Date]), the query runs over 5 minutes. In this case, the form field has the exact same value (12/31/2014).
Ive encountered similar issues using Access 2000, 2003, etc. This is quite frustrating. Does Access interpret #date value# is a special way? Is there a way to trick Access into the thinking a soft coded date is a hard coded date?
View 1 Replies
View Related
May 20, 2005
I have a front end that is connected to three back end files. The front end is on my local computer while the back end files are on a network drive.
There are a lot of calculations that go into the queries and intermediate queries. For a report, I have based it on a UNION query.
But when trying to design the report it takes about 45 seconds just to do any one thing, e.g.;
- Add Groupings
- Add Grouping Headers//Footer, sorting option
- Add bound textbox
:eek:
Needless to say this is very annoying.
:mad:
The union query itself runs fine (takes about 15 seconds to run) and returns about 12,000 Rows. The union query looks like this (I changed the field names to make it read easier, hopefully);
SELECT a1, a2, a3, a4, a5
FROM qry_A;
UNION SELECT ALL a1, b2 AS a2, b3 AS a3, a4, a5
FROM qry_B;
UNION SELECT ALL a1, c2 AS a2, c3 AS a3, a4, a5
FROM qry_C;
UNION SELECT ALL a1, d2 AS a2, a3, a4, a5
FROM qry_D;
UNION SELECT ALL a1, e2 AS a2, a3, a4, a5
FROM qry_E;
UNION SELECT ALL a1, f2AS a2, tblG.f3 AS a3, tblG.f4 AS a4, a5
FROM qry_F;
One solution I came across when searching the forums was to use an Append Query to append the query results to a table and base my report on that. This does indeed fix the problem.
But what I was wondering if it was is my query design that is causing it to be slow or is it just the fact that I am returning 12,000 rows?
:confused:
In case it matters, I wanted to mention that I can’t use the report wizard to create the report. When I select the union query, the fields will be showed for awhile then they just disappear. That in and of itself doesn’t cause any trouble since I am creating the report using the design view and not the wizard.
View 7 Replies
View Related
Jun 28, 2005
Hi Guys,
I have got a query that updates details from one table2 to table1, "Reference" is the primary key and this is what the query uses to determine which need updating.
It all works great but if table2 contains a record in "Reference" that is not in table1 i just want it to ignore it, currently it just seeems to add them.
Any suggestion guys & gals?
Many thanks
Tim
View 9 Replies
View Related
Nov 29, 2006
Ok, i have a question about update queries.I have two tables (I'll call table 1 and table two for simplicity) and an update query. I want to get some data from table one to table two (via an update query). But in table two there is a field that isn't in table one but i want to add a value to that field via the query.My question is, can i manually put into the query what data to add to a field instead of/aswell as using data from other tables.I hope you understood my questions.Cheers
View 3 Replies
View Related
Nov 8, 2006
Hi,
My DB is very slow when it's used by more than 1 person at a time. It's divided into FE/BE. The BE is in a shared server and a copy of the FE is in each person's machine.
I don't know why it takes ages to respond. Any help will be very much appreciated.
Regards,
B
View 8 Replies
View Related
Apr 29, 2005
Hi all
I have an Access 2003 db that works extremely well as a stand-alone application but I am keen to “split” it so that many users can operate it together.
Accordingly I did the split and placed the tables on our server, and tried running the front end locally.
Much to my horror, it takes about a minute to open, and many seconds to do anything after a button press etc.
I have been testing it on my wireless home network and the same thing happens, except now I can monitor network activity from the “network working” light.
What I see baffles me and would welcome comments, in particular, what I can do to speed it up by a factor of 100!
1.It takes forms about 50 seconds to open; however, this is due to about 40 seconds of network activity BEFORE the form’s load event fires!
2.In DESIGN mode, any minor change to a control for example, results in about 40 seconds network activity.
3.All queries upon which forms are based take well under a second to run over the network.
4.Making an mde file has no effect.
I thought the idea of splitting was to keep the forms/queries/code etc, local to a machine so I don’t understand what all the network activity is about, particularly in design mode. Also, given the actual queries are so fast, just what is Access doing??
Any comments please?
Skeletal
View 3 Replies
View Related
Jun 2, 2005
I have a form with a subform (there is no child parent relationship) , when I open the mainform it causes the subform to slow down.
ie If I open the suform by itself - it opens quickly
If I then open the main - it runs quickly
If I then open the main again it runs slow or if I open the subform again - it runs slow - it continues to run slow - until I have opened the sunform by itself.
So something in the mainform is causing the subform to slow down.
Help! Thanks
View 2 Replies
View Related
Jun 24, 2005
I am using Access 2003 but it is to slow, what can I do?
View 1 Replies
View Related
Apr 4, 2006
Hi,
I have a database for booking equipment in and out.
I have the backend stored on a shared drive on our LAN, and the front end on each client machine.
The database has been working fine until just now, it runs very slow and my DCount functions have stopped displaying data.
I have no idea why this has happened, please help?
View 1 Replies
View Related
Aug 24, 2006
hi all,
i'm create a aplication in ms access 2000 developer edition. this app comunicate with sql 2000.
we have problem with slow connection provided by access. in headquater wher people use access app it working quickly. sql 2000 is localted at headquarter too. but if i run app in warehouse it working very slowly.
VPN connection doesn't slow. but access can't use all vpn connection capacity but only 1/5 from this capacity?
how can i do something that acces can use all capacity that i have?
example: link is 512 kbps but access use only 100kbps and work very slowly.
View 1 Replies
View Related
May 30, 2007
I developed a sales database that contains around twenty forms, (in addition to tables, queries, reports and 2 modules). In these forms, I'm setting recordsets, select statements and filters. We recently hired a person to set up a Virtual Private Network. After spending a couple of thousands on a server and countless hours reprogramming the database to have multiple users access the database out in the field, (via Verizon broadband network card), we were unsuccessful to use the database since it was taking too long to download the data or perform any calculations. The database is split. The users have a front end.
The person setting the VPN has suggested that I get rid of all the queries that I have in the forms (which is impossible), or use Visual Basic for the front end instead of Access with VBA.
When I set up the recordsets I use the following setting:
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.LockType = adLockOptimistic
I don't know what to do. This program is very complicated and I don't want to have to reprogram the whole thing with Visual Basic, and I don't know how the front end is going to work if I eliminate all the queries, select statements and filtering.
Any ideas, comments or suggestions would be appreciated.
Maritza
View 2 Replies
View Related
Feb 25, 2008
At the moment, I have a very simple Access 2007 database with 3 small tables, and 4 small forms.
In two of the forms' headers, I have a text box with contents '=Nz([FirstName] & " " & [MiddleName] & " " & [LastName],"Untitled")' which I took from Microsoft's Marketing Projects sample database.
When I open the two forms with this text box, the forms displays instantaneously except for this text box -- this text box doesn't show its contents for almost a full second. The part of the form that displays right away includes the fields FirstName, MiddleName, and LastName, so it's not that Access is taking forever to pull the row of data...
The database isn't too large. It's about 800K.
It isn't the computer, it's an Intel Core2 Duo E6600 with 4GB memory.
Any ideas on how to speed this up? Is there a totally different way I should be doing this?
As you can problaby tell, I'm relatively new to Access. I've read a few books, but am at a loss why this function is running so slowly. Before, I've focused on web development however this client requres Access for this project. Any help would be much appreciated!
View 14 Replies
View Related
Apr 22, 2005
I have a very simple table with about 20 fields. The thing is it has about 360,000 records in it. It has always been a little slow to open, although using a query works pretty fast. There is just this one table, no forms, no reports, no saved queries. Simple database with one table, but it takes forever to open now, seems to have gotten worse. I have compacted and repaired many times and it does not help. The database is stored on a server.
When I click to open the table up it says RUNNING QUERY at the bottom of the screen and then runs and runs for a LONG time. I cannot rely on queries since we want to keep this real simple for users of this data. Just go in, do a FIND or a FILTER and that is it.
Any idea why this is running so slow, or why it says RUNNING QUERY when I attempt to open it, is that normal?
Thanks.
View 5 Replies
View Related