Code Keeps Crashing Access
Feb 15, 2005
on a small scale this code works, but when my inventory table has all of the 2000 records it crashes, any ideas.
I can ftp my database if needed
Code: Dim ColorDim StartPointDim RsItem As DAO.RecordsetDim RsNewItem As DAO.Recordset 'Grab the inventorySet RsItem = CurrentDb.OpenRecordset("select ItemId,Description1,description2,quantityonhand from item")'grab the table that will have the new item and description addedSet RsNewItem = CurrentDb.OpenRecordset("select * from newitems") With RsItem While Not .EOF StartPoint = 1Start:'find out if the last numbers is numeric or notIf IsNumeric(Mid(Right(.Fields!itemid, StartPoint), 1, 1)) = True Then'see if the start point is the last letter or notIf StartPoint = 1 Then 'meaning there is no colour indicated at the end of item Else'add the quantity and the color to the newItem tableColor = Right(.Fields!itemid, StartPoint - 1)RsNewItem.AddNewRsNewItem!Description = .Fields!quantityOnHand & ColorRsNewItem!itemid = .Fields!itemidRsNewItem.UpdateEnd If Else'move the startpoint to the next letter in itemStartPoint = StartPoint + 1GoTo StartEnd If .MoveNextWendEnd With
View Replies
ADVERTISEMENT
May 1, 2005
I don't know if this is caused by Access (2003) itself, or somethign else, such as the JET drivers. Whenever I load up anything in Access it crashes saying I can repair it and restart access... no matter what I load.
Also, it seems other programs that connect to a database only retrieve 'nothing' from the tables and queries. I'm quite confused, any help would be wonderful right now.
Running on Windows XP SP2 with Access2003
View 5 Replies
View Related
May 30, 2005
My MS 2000 Access application is crashing and returns a msg something like this: "Your Access application caused an error and Access must be closed"
This occurs only when I execute some forms; always the same forms cause the problem.
Somebody told me to copy the .mdb to another place in my HD and change the names of the forms.
I did it and it always works well!
Any good reason for that?
My app is not yet splited in FE and BE. Splitting would help?
Thanks a lot
View 1 Replies
View Related
Aug 23, 2005
Every time I try to import a CSV file into my Access database it crashes. I've tried repairing it but the repaired database crashes as well. Any ideas on what could cause this?
Thanks.
View 8 Replies
View Related
Apr 27, 2007
Hi. I have been fixing up some access 97 programs on the computer systems at my work. The main changes I made was creating a search function using a query behind a form to search the database (no more than only 90,000 records). I am running a novell server. The data tables are in a database on the server. The access program on the desktops have their own access database program that use linked tables to the data tables on the server. The following is my issue:
Apparently, some of the changes I made to the searches caused the server buffer to become full and not flush itself. Anytime I was working on creating the fixes, it seemed to make the server crash. I 'm just wondering if anyone has had a similar problem with access 97 running on a novell server and causing any buffer issues. Any ideas on how to prevent the server from crashing?
View 3 Replies
View Related
Jun 28, 2007
Hi all, 1st post. I'm and Access n00b I'm afraid, so take it easy. I normally use php/mysql, but have been roped in to fixing a broken access database.
I've got an Access database, and a fileserver is holding the data (mdb file), but I've got around 10 machines which access the database thru a frontend (mdb file).
Now, this has been working fine until today, where I am trying to view one table (Orders), and access bombs out. It shuts down instantly with no warnings. It does this on every machine, so I think it is a database problem. I can view the data if I open the standalone data file, but I cannot view the data thru the frontend.
I need to fix this asap... what's causing the crash? I didn't make the front end, but if I could look at the code, I may be able to see where it's failing.
View 3 Replies
View Related
Jul 9, 2014
I am trying to build an event when I double click a field. As soon as I click on Code Builder, access crashes. It does this with every access database I open.
View 14 Replies
View Related
Oct 24, 2012
I have a simple calculated field (As "Ratio") that is readable in Access 2010 query, but crashes in Excel upon importing/running the query in an .xlsx table.
ERROR MESSAGE in EXCEL: "The query did not run, or the database table could not be opened...check database server..contact your database administrator.."
I am simply taking the cost amounts of each project record (shown as "Record Cost") and dividing it by the "Total Cost" of that project to render "Ratio".
The Total Cost is retrieved from another table.
Testing scenarios:
If we exclude Ratio, the whole query import just fine.
If we filter the query to one project (i.e. "Project A") the ratio field imports fine.
However, the whole unfiltered query does not with the ratio!
Other testing scenarios:
If we use a constant for the denominator AS "1" in Ratio (i.e. recordcost/1) the whole unfiltered query and ratio field imports fine.
If we use a constant for the numerator AS "1" in Ratio (i.e. 1/totalcost) the whole unfiltered query upon import crashes in Excel.
This is a mock example of the dataset, the actual query has 50K+ records:
Project Service Date Record Cost Total Cost Ratio
A Welding 1/1/2012 $100 $120 83%
A Plumbing 2/1/2012 $20 $120 17%
B Welding 1/1/2012 $50 $75 67%
B Plumbing 2/1/2012 $25 $75 33%
C Welding 1/1/2012 $40 $61 66%
C Plumbing 2/1/2012 $21 $61 34%
View 5 Replies
View Related
Jul 18, 2005
So here's my situation: Tonight I opened the file I was working on this morning (which was in perfectly fine state)...
I opened a form - CRASH!!
I press ALT+F11 to go to the VBA editor - CRASH!!
I open another form - it works fine... So i select a button and tried to edit the action script - CRASH!!
I relinked the backend file - CRASH!!
It seems everying I do makes the darn thing crash. :mad:
I tried compacting/repairing - no luck there. This is not the first time it has happened to me. I forgot how i managed to fix it the first time. Anyone with experience with this? Any suggestions?
I tried opening an older db file, and was able to access the VBA editor for that file. But it crashed again when i tried going back to the bad file.
If i recall correctly, I think this morning, when I closed my access file, I closed the Access Program long before I finally closed the VBA editor (didn't realize it was still around because the taskbar was a bit cluttered). Wonder if that caused it to go hay-wired.
View 3 Replies
View Related
Feb 23, 2006
I've come across a problem with my database, I’ve tried everything I can think of, and I’m still no wiser as to what’s causing the crashes. I hope someone can shed some light on what the problem might be.
I've created a database that uses a switchboard to navigate through the various forms, the switchboard is loaded (using the start up options) most of the database objects are switched off (like display database window), apart from 'allow full menus' and 'allow default shortcut menus'.
This reason I’ve given you the above information is that the error only occurs when the database is loaded through the start up options.
If I open the database bypassing the start-up options this error doesn't occur.
Now to the error:
I have various forms that have a button that will attempt to send an e-mail, its set up that the email doesn't send automatically but allows the user to edit the email before sending.
When the e-mail is created using the code below, and the user decides to cancel sending the email by pressing the 'close' button on the email, the database will lock up.
The first error message I get is:
The sendobject action was cancelled
You used a method of the DoCmd object to carry out an action in visual basic, but then clicked cancelling a dialog box.
For example, you used the close method to close a changed form, then clicked cancel in the dialog box that asks if you want to save the changes you made to the form.
The second message is my error trapping for cancelling the email, and then after that the form loses focus and I can't do anything to the database. It's still running because I have a clock on my form that’s still ticking away.
The only way I can close my database is to 'ctrl alt del' and 'end task' it. When I do this I get another error message saying
You can't exit the database now
If you are running a visual basic module that is using OLE or DDE, you may need to interrupt the module
And then the database closes.
I've noticed the crash only occurs when the 'display database window' option is turned off.
When its on then my error trapping deals with the closing of the email.
Private Sub MailCreditReport_Click()
On Error GoTo Err_MailCreditReport_Click
Dim stDocName As String
If Me.Dirty Then
DoCmd.RunCommand acCmdSaveRecord
Else
End If
stDocName = "rptCreditAuthorisation"
DoCmd.SendObject acReport, stDocName, acFormatRTF, , _
, , , , True, False
Exit Sub
Exit_MailCreditReport_Click:
Call ReportError
Exit Sub
Err_MailCreditReport_Click:
Select Case Err.Number
Case "2501"
MsgBox "User cancelled Sending E-mail(s). Please Resend", vbExclamation, "Sending Stopped"
Exit Sub
Case Else
Resume Exit_MailCreditReport_Click
End Select
End Sub
I've tried various things with the code like DoCmd.CancelEvent, but nothing seems to make any difference.
Any help would be greatly appreciated.
View 11 Replies
View Related
Oct 30, 2007
Anyone,
I posted at the begining of this month with an URGENT post and had a lot of help off some of you guys. My database was corrupting and crashing and I had a lot of help of rural guy and others. By the finish of the two days I had compiled and decompiled my database and lots of other little tricks to try and make it a bit better.
At the end of the two days the database was up and running but I had to delete three of my forms because the VB Script that was attached to them forms would not delete. I managed to get it working but I am now having further problems.
Althought the database is useable without these forms I can not re-create them. I have tried importing them into a new database, compiling them then importing them into the FE, but it still crashes. I have also tried just creating a new form and starting from scratch but it will not let me create a new form from scratch. It runs very slow and still crashes on development. my Back-end is working fine.
Does anyone know of any common errors that may be causing these problems. I am now in discussions with my boss because the only thing I can think of doing is starting my FE front scratch.
Any sugggestions
View 5 Replies
View Related
Sep 22, 2006
I am a novice database user and I built a small job tracking database for a small construction company. For the last 2 days, Access has become very unstable and I am getting the "Sorry but Access has to close" message shortly after opening. I have tried the "repair and compact" utility but no change and it still crashes. Is there other troubleshooting procedures that I can use or can you recommend someone to do the repair work?
View 1 Replies
View Related
Dec 1, 2007
I've redeveloped my DB so that all forms are unbound. I did this due to a multiuser environemt of 30 or more users.
I left all reports bound because there were fewer than 10 concurrent users running them at any one time.
But... I'm finding the DB crashes when a second user runs the same report concurrently. Maybe its data binding overload?? Would setting the underlying query recordset type to snapshop overcome the problem??
I appreciate any ideas
View 6 Replies
View Related
Jan 31, 2006
I'm attaching the code for a function that's attached to a button that allows the users to export data from a form to the directory and file of their choice.
This code works when we're just running Access, but we need it to function in runtime, and it just crashes with an entirely uninformative "runtime error" message.
I didn't write this code, but looking at it, it seems to be just a copy of what's in the MS knowledge base about the filedialog function.
I also never write my own applications using runtime (the program we're running this is was contracted for our lab), so I have no idea why this would be failing in runtime but not in Access. Can anyone help?
View 1 Replies
View Related
Sep 10, 2014
We have been calling a main form to manage yacht races using a hyperlink/macro from a selection form which lists all the yacht races ..The main form was too big to fit on some screens so we changed it to pop up mode to allow it to be resized and use scroll bars. this works well when the form is opened manually and all functions run just fine
the hyperlinik/macro for race selection had originally been set up to call the main form in dialog mode but we have had to change this as it disabled the resizing of the form and the scroll bars..The macro tool doesn't offer pop up mode so i selected window mode = normal and the main form opens with a resizable window and scroll bars but all the functions called from this module now fail (error message = use of null value or similar and all the functions go into debug mode - the server is down and i can't access the system to get the exact details)
If i change the macro in the selection form back to window mode = dialog the functions work but i lose the resizing of the main form and and the scroll bars.
View 1 Replies
View Related
Oct 24, 2013
I've been using the following code successfully in Access 2003 & now I need to migrate to Access 2010. The purpose of the code is to use the items that the user selects in the list box to build the criteria of a query. Access 2010 keeps giving me a syntax error when I try to run the query & I don't know why:
My code is:
On Error GoTo Err_Command151_Click
' Declare variables
Dim db As DAO.Database
Dim qdf As DAO.QueryDef
Dim varItem As Variant
Dim strCriteria As String
Dim strSQL As String
[Code] .....
The syntax error I get in Access 2010 is:
Syntax Error in query expression 'SELECT * FROM
qryContractListSummarybyDateContract3TYPEBREAK WHERE
qryContractListSummarybyDateContract3TYPEBREAK.Rep ortableName IN('Adbri
Masonry NSW');'
View 12 Replies
View Related
Jul 23, 2007
Iam using the following code for inserting the values from access form in to the access database table ITEMS, but iam getting compile errors, may i know where iam going wrong in the code.
Also help me in updating, deleting and viewing of records from database table ITEMS to the form when i run the program.
Following is my code :
Private Sub ADD_Click()
On Error GoTo Err_ADD_Click
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = CurrentProject.AccessConnection
'Create an instance of the ADO Recordset class, and
'set its properties
Set rs = New ADODB.Recordset
With rs
Set .ActiveConnection = cn
.Source = "SELECT * FROM ITEMS"
.LockType = adLockOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseServer
.Open
End With
'Set the form's Recordset property to the ADO recordset
DoCmd.RunSQL "INSERT INTO ITEMS(ITEM_CODE, ITEM_NAME, ITEM_CATEGORY) VALUES('" & ITEM_CODE.Text & "','" & ITEM_NAME.Text & "','" & CATEGORY.Text & "')"
Set Me.Recordset = rs
Set rs = Nothing
Set cn = Nothing
Exit_ADD_Click:
Exit Sub
Err_ADD_Click:
MsgBox Err.Description
Resume Exit_ADD_Click
End Sub
compile ERROR as follows:
you can't reference a property or method for a contro unless the control has the focus.
View 13 Replies
View Related
May 30, 2005
Hello to everyone!, Could I ask a help how could I possibly code MS Access Startup to set the MenuBar, ShortCut Menu, FormMenu, Special Keys to OFF to prevent user from using these keys when my application starts?
Thanks for your help...
View 1 Replies
View Related
May 10, 2006
I've got 2 sub forms that I intend on using via a toggle button from my primary form to access them. Is there anyone that can give me a heads up on creating vb code that when OnOpen it will automatically advance to a new record for data entry? I want the form to keep anyone from accidentally changing existing info in that regard. I'm still really new with VB.
Thanks for any help,
Trey
View 1 Replies
View Related
Sep 22, 2004
I dont get any errors with this code. Let me explain what im doing:
T1 = temparary table (not really temparary but the values just change so often it might as well be)
this table has field names: partname, order, maxorder, etc. stuff like that
pretty much its a table that has records for each part name.
T2 = main database
this table holds the order for all parts for a particular time and day
T1 is the one that people are familiar with, where as T2 's set up is something that they would not be, so for clarity we use T1 for displaying etc.
now my problem is, i try to transfer data from one table to another but it works sometimes and doesnt work others, i dont get any errors and i have option explicit on as well. if someone could look at this code and tell me if there are any problems that you see, the quicker the response the better.
technical specs:
Access 2000
Windows 2000
Code:
Private Sub insertRecMainDB(ByVal typeOfOrder As String)
'This sub will insert a new record of type O (Ordered) and put in all values from the table Order
'Also it will make a duplicate record of type R (Received) and put in same values so when later
'if there are no changes (meaning all product was received) no entry has to occur, however if you
'are missing a part then you can enter how many on the other form.
Dim yesOrNo As String
Dim tempSQL As String
Dim rec As New ADODB.Recordset
Dim orderAmountRec As New ADODB.Recordset
Dim partNameRec As New ADODB.Recordset
Dim numOfRecords As Integer
Dim cnt As Integer
'Checks the type of order and either checks or does not check it in the DB
If typeOfOrder = "O" Then
yesOrNo = "yes"
Else
yesOrNo = "no"
End If
'Create the SQL statements to update MainDB
tempSQL = "INSERT INTO [MainDB] ([OrderNumber],[DateTime],[OrderedReceived],[TypeOfOrder]) VALUES (" + CStr(txtOrderNumber.Value) + ",'" + CStr(lblDateTime.Caption) + "'," + yesOrNo + ",'" + typeOfOrder + "')"
CurrentDb.Execute (tempSQL)
'Counts the number of parts we have to order, saves it in numOfRecords
rec.Open ("SELECT* FROM [Order]"), conn, adOpenStatic, adLockReadOnly
numOfRecords = rec.RecordCount
rec.Close
'Loop to transfer data from the table Order to the table MainDB
For cnt = 1 To numOfRecords
'Gets the name of each part
tempSQL = "SELECT [Description] FROM [Order] WHERE [PartNumber]=" + CStr(cnt) + ";"
partNameRec.Open (tempSQL), conn, adOpenStatic, adLockReadOnly
'Gets the amount ordered of that part
tempSQL = "SELECT [MaterialOrdered] FROM [Order] WHERE [PartNumber]=" + CStr(cnt) + ";"
orderAmountRec.Open (tempSQL), conn, adOpenStatic, adLockReadOnly
'Updates that part name with the ordered amount
tempSQL = "UPDATE [MainDB] SET [" + CStr(partNameRec.Fields(0)) + "]=" + CStr(orderAmountRec.Fields(0)) + " WHERE [OrderNumber]=" + CStr(txtOrderNumber.Value) + " AND [DateTime]='" + CStr(lblDateTime.Caption) + "' AND [TypeOfOrder]='" + typeOfOrder + "';"
CurrentDb.Execute (tempSQL)
partNameRec.Close
orderAmountRec.Close
Next
End Sub
View 1 Replies
View Related
Apr 5, 2007
Hi,
I have a form in access database. On click of a button I want to perform update process for records in a table "abc" in the same database. I have written the following code in the onclick function,
Code: Dim rs As New ADODB.Recordset Dim rsCount As New ADODB.Recordset Dim CntVal As Integer Dim con As New ADODB.Connection con.Provider = "microsoft.jet.oledb.4.0" con.Mode = adModeShareExclusive con.Open ("C: est.mdb") rs.Open "Select * from abc" Do While Not rs.EOF rsCount.Open "select count(test) from abc where test = '" & rs.Fields("test") & "'" If Not rsCount.EOF Then CntVal = rsCount.Fields(0).Value Else CntVal = 0 End If rsCount.Close con.Execute "Update abc set testcount = '" & CntVal & "' where ID1 = '" & rs.Fields("ID1").value & "'" Loop
In the above code, I am not able to use the command,
con.Open (App.Path & " est.mdb"). It gives "Object Required Error". And while opening the con object I get the error "You attempted to open a database that is already opened exclusively by user 'Admin' on machine ''. Try again when the database is available."
Kindly advise how to solve this problem.
View 2 Replies
View Related
Oct 18, 2007
I have a form that is created in Access but uses some VB code. Here is my problem..... I have one form that the users do money transactions on. Then I have created a form that will allow them to Void a transaction as well as Refund a transaction. On the Void/Refund forms it will query the user for the Receipt No. once that information is pulled in, there is a command button that says "Void Ticket Sale" on the Refund form it says "Refund Ticket Sale". What I'm trying to do is, once the user enters the receipt no and hit that Void/Refund Ticket Sale button - if it has already been voided/refunded, a message box will come up and say "This Ticket has already been voided/refunded". If it has not, the "Void Ticket Sale" command will carry on. Here is a snippet of my code, I'm not sure what I'm doing wrong.
Private Sub cmdRefund_Click()
On Error GoTo Err_cmdRefund_Click
'this is a AddRec button, caption was changed to read Void
Dim Answer As Integer
Dim Result
Dim sqlstmt As String
sqlstmt = "Select Count( * ) from tbl_transactions where PaymentType = Void And VoidRefundID = Me.TransNumID"
Answer = sqlstmt
If Answer > 0 Then
MsgBox "This Receipt No. has already been voided."
Exit Sub
Else
Result = MsgBox("Are you sure you want to Refund Receipt No " + Str$(Me.TransNumID) + "?", vbYesNo, "Refund Receipt")
If Result = VbMsgBoxResult.vbNo Then
DoCmd.Close
Exit Sub
End If
End If
View 14 Replies
View Related
Sep 28, 2005
Hi,
Does anyone know how to compact a ms access 2000 db in vba code. I want the database to compact evertime it is opened up.
Thanks
View 2 Replies
View Related
Jul 26, 2007
Hello,
When I add a butten using the wizard Access 2007 adds a macro instead of vba code.
How can I get the good old VBA code???
Thanks for your help in advance
View 11 Replies
View Related
Dec 28, 2004
Hi,
I need to know is there any specific code that would establish link for tables from Access BE?
I know it using Get External Data...Link Tables. Even though they are in other db but it leads to increase heavy size of main db. I want no table objects (except system tables) to be displayed in main db and only link tables once main db activates and should no table remain exists in FE after closing.
There should be some way to establish connectivity of tables from Access BE at the time of opening main db . This will help a ton to reduce the size of main db and its zip file can be copied even in a 1.44 mb floppy.
I heard something about shell but exactly I don't know how to do it.
Any idea....
With kind regards,
Ashfaque
View 4 Replies
View Related
Dec 14, 2005
I have the (.frm) code for the forms that were created with VB5. How do I use this code to create forms in MS Access 2000?
View 1 Replies
View Related