473,671 Members | 2,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Database closes unexpectedly

296 Recognized Expert Contributor
Does anyone know why my database sometimes closes on its own for no apparent reason? I don't think it has anything to do with my code because, as an example of when it closed on me, I was entering data on a form with a subform. I entered data for about 15 records and it worked absolutely fine, then I clicked next record as I did previously, and the entire database closed on me. I was having this problem before when I was trying to open the subform mentioned above, on its own, but figured out that it was due to an expression referring to the main form (which it couldn't find since the main form wasn't open at the time). Any ideas on this one? It happens so unexpectedly that it's really hard to say what's causing the problem, except that it is always related to the above mentioned forms.
Jul 17 '07 #1
15 12873
mlcampeau
296 Recognized Expert Contributor
It just did it again. Again, I was entering data into the form, and as I tabbed from one field to the next, the status bar in Access said "Calculating... " and then the entire database closed.

As mentioned before I am using a main form (JobVacancy) and subform (JobVacancySubF orm). The main form is informational only and displays the job code, job title, pay grade, and then there are three textboxes.
1. TotalPositions: Calculates the total number of positions available:

=DSum("[NumberofPositio ns]","[JobVacancy]","[code]=[JobVacancy]![JobCode]")

where NumberofPositio ns is a field in the JobVacancy table and Code is the job code on the main form (this field gets updated in the subform)

2. TotalOccupants: the total number of employees that have this particular job as their job title calculated by

=DCount("*","MY - JobVacancy2","[MY - JobVacancy2]![JobCode]= Forms![JobVacancyMain]![code]")

where MY - JobVacancy2 is a query and JobVacancyMain is the main form.

3. TotalVacancy: the total number of vacancies related to this position

=IIf((DSum("[NumberofPositio ns]","[JobVacancy]", "[code]=[JobVacancy]![JobCode]"))-(DCount("[MY - JobVacancy2]![ID]","MY - JobVacancy2","[MY - JobVacancy2]![JobCode]= Forms![JobVacancyMain]![code]"))<0,0, (DSum("[NumberofPositio ns]","[JobVacancy]", "[code]=[JobVacancy]![JobCode]"))-(DCount("[MY - JobVacancy2]![ID]","MY - JobVacancy2","[MY - JobVacancy2]![JobCode]= Forms![JobVacancyMain]![code]")))

I put this in the if statement because there are cases where there are more employees than positions (sometimes an employee is terminated but the db hasn't been updated yet, etc) so instead of displaying a negative number, I just want to know that there are 0 vacancies.

My subform, called JobVacancySubFo rm, is based on a query and has 2 combo boxes, one to display the department and one to display the division that the job is in. The user selects the department and division, and then enters the Number of Positions .

I then have 2 more textboxes with calculations:
1. CountofId: calculates how many employees have the particular job title displayed in the main form, and are located in the particular department and division in the subform (I should mention that the subform is a continuous form)

=DCount("*","MY - JobVacancy2","([MY - JobVacancy2]![JobCode]=Forms![JobVacancyMain]![code]) AND ([MY - JobVacancy2]![DivisionCode]= [JobVacancy]![DivisionCode])")

2. NumberofVacanci es: Calculates the number of vacancies in this particular department and division

=IIf(([NumberofPositio ns]-(DCount("*","MY - JobVacancy2","([MY - JobVacancy2]![JobCode]=Forms![JobVacancyMain]![code]) AND ([MY - JobVacancy2]![DivisionCode]= [JobVacancy]![DivisionCode])")))<0,0,([NumberofPositio ns]-(DCount("*","MY - JobVacancy2","([MY - JobVacancy2]![JobCode]=Forms![JobVacancyMain]![code]) AND ([MY - JobVacancy2]![DivisionCode]= [JobVacancy]![DivisionCode])"))))

Again i do not want negative numbers to display.

I have a feeling that the system is just getting bogged down with these calculations, which is causing it to shut down unexpectedly, so if anyone has any suggestions, I'd really appreciate it!! Please keep in mind that I have never coded in Visual Basic before, so if that's where your solution lies, please give lots of details!
Jul 17 '07 #2
nico5038
3,080 Recognized Expert Specialist
Hmm, the calculations won't cause this in general, but it looks like your database has gone corrupt.
Try my MS Access database recovery steps:

1) Create a backup of the corrupt database. (Just in case of)

2) Create a new database and use File/Get external data/Import to get all objects of the damaged database.

3) Try these Microsoft solutions:
Repair A97/A2000:
http://support.microsoft.com/support.../Q109/9/53.asp
Jetcomp:
http://support.microsoft.com/default...;en-us;Q273956
and/or read the article:
ACC2000: How to Troubleshoot Corruption in a Microsoft Access Database
http://support.microsoft.com/default...b;en-us;306204

4) Bit "heavier":
Access decompile:
http://www.granite.ab.ca/access/decompile.htm

5) Try a recovery tool / Table rescue
Table datarecovery:
www.mvps.org/access/tables/tbl0018.htm
Access recovery:
http://www.officerecovery.com/access/index.htm

6) Ask a company (will cost $$'s ! )
http://www.pksolutions.com/services.htm

check also: http://www.granite.ab.ca/access/corruptmdbs.htm


Nic;o)
Jul 18 '07 #3
mlcampeau
296 Recognized Expert Contributor
Thanks for all the links! I've taken a look at a couple but will look at them all a bit more thoroughly in a bit. I have already tried compacting the database, but I still have the same problem. The articles have solutions for fixing corruption when you know which part of the database is corrupted. Is there a fairly simple way to figure that out? In my case it's a little bit difficult because I don't get any error messages - Access just freezes for a second while "Calculatin g" and then closes. And it's never consistent on when it does it. I'll keep looking through those articles to see if I can find anything!
Jul 18 '07 #4
missinglinq
3,532 Recognized Expert Specialist
I agree; sudden unexpeced closing of a db is almost assuredly a harbinger of corruption! And amazingly, Steps # 1 & 2, simple as they are, often work!

Linq ;0)>

Added note: You say you've tried compacting, but have you tried compiling your code? This will frequently identify problems.
Jul 18 '07 #5
mlcampeau
296 Recognized Expert Contributor
I've never had to import before (Steps 1 & 2). I'm trying it right now, but the problem I'm running into is that my corrupted database requires a password so when I try to import, it says that I do not have the permissions - how do I get around this?
Jul 18 '07 #6
nico5038
3,080 Recognized Expert Specialist
Hmm, what type of database do you have ?
Normally a password would be known when you use one. Haven't you developed the .mdb yourself or is it a .mde ?

Nic;o)
Jul 18 '07 #7
mlcampeau
296 Recognized Expert Contributor
Hmm, what type of database do you have ?
Normally a password would be known when you use one. Haven't you developed the .mdb yourself or is it a .mde ?

Nic;o)
The database was already made - it's one of those buy it and customize it to your needs type, so I have been doing all modifications while being signed in as the system administrator. When I say modifications, I basically mean I populated the database, and added a couple tables/forms to add some functionality. Other than that, I have not messed with the original set up. To be honest, I'm not 100% sure if this is a .mdb or .mde - I thought it was .mdb but now I can't actually find anywhere that it says that. It just says Microsoft Office Access Application - I'm using Access 2003 if that helps.
Jul 18 '07 #8
nico5038
3,080 Recognized Expert Specialist
Hmm, never used such a database, but for the .mdb or .mde you only have to lookup the name of the database in the folder it's situated.
When you open the database as an admin, is it asking for a password ?

Nic;o)
Jul 18 '07 #9
mlcampeau
296 Recognized Expert Contributor
It is a .mdb. And yes, as soon as I try to open the database, it asks for a username and password before it will open. I suspect I would need to disable that in order to import, but am not sure exactly where to do that (Tools --> Security --> ??) - I would need to turn the password back on once imported though because there is sensitive information in the database.
Jul 18 '07 #10

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

Similar topics

3
2889
by: Sven Jacobs | last post by:
Dear newsgroup, I've upgraded to PEAR::DB 1.6.5 recently. Unfortunately now the database connection doesn't work as expected anymore :( The problems seems to be the method disconnect(), which now closes the database connections of _all_ database objects. I ask myself if this is intentional or a bug. Below a code example: 01 <?php 02   error_reporting(E_ALL);
4
2333
by: Niel | last post by:
Hello friends, I am not sure if i am posting to the correct group but if anyone has an idea about this and the possible solution or the link to that solution then please let me know We have out website running on Windows 2000 - IIS 5.0. Everything was working fine but since last few days my IIS Services get stopped unexpectedly. When i check in even viewer i see the message saying a) "The World Wide Web Service got terminated...
3
392
by: Chris LaJoie | last post by:
We (My team and I) are currently developing an application that works fine on 3 of our dev machines, but our 4th is having a problem. It's an old P3 733Mhz with 192MB RAM and running XP Pro. It runs the program we're developing just fine, until it tries to close. About 60-70% of the time, it will reboot the system unexpectedly. It reboots without delay, it appears that the program's main window is still opened at the moment it reboots,...
4
1979
by: Riley DeWiley | last post by:
I am using Jet 4.0 through OLEDB and C++. My travails with compaction are well known to regular readers of this NG. Many of my problems were solved by disabling record locking. I am now confronted with two remaining mysteries, which I suspect are related: ------------------------------------------------------------- The Mystery of the Zombie Session (a horror story)
2
19473
by: Matt Sollars | last post by:
Hi all. I'm having a nasty problem. A client's website was originally written with classic ASP. They requested a new portion of the site that was deemed a perfect candidate for ASP.NET. So, .NET was installed on their web server and one of the subdirectories in the web site was converted to a virtual application to support the new pages that would be added. The rest of the site was left untouched. New aspx files were added to this...
35
4832
by: Terry Jolly | last post by:
Web Solution Goal: Have a global database connection Why: (There will be 30+ tables, represented by 30+ classes) I only want to reference the database connection once. I put the connection string in the web.config. I created a class with a static database connection and the class opens and closes the database.
2
2254
by: BrianHIckman | last post by:
MY MS Access application, all code in VBA, suddenly closes unexpectedly when attempting to open a specific form which contains combos and standard fields, fed by qry A which in turn calls qryB. I can't get at the form in design view or form view. Have tried Compact & Repair withou success. Can any genuis out there help please? XP HOme SP1 VIrus up to date Adaware used regularly
9
3661
lotus18
by: lotus18 | last post by:
Hello folks I have a form with textboxes to input and it is showed as modal form (form 1.showDialog). I created a validation for my form and it should not save unless all the fields are filled up (e.g. MessageBox.Show("Please fill up all the fields", "Unable to save", MessageBoxButtons.OK, MessageBoxIcon.Information). Now, my problem is when I leave blank on one of the textboxes, of course a messagebox will pop up but after that it closes...
3
10502
by: Johnson | last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio 2008 issue -- thus posting to 3 groups. Please don't be offended. The problem I'm encountering is that Visual Studio closes unexpectedly and without any error message being displayed, or error messages written to the system logs. Visual Studio closes when I attempt to open an ASP.NET Web application (not Web site) solution for which IIS is set as the project's...
0
8476
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8393
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8917
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...
0
8821
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8598
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
8670
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
7437
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...
0
5696
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
4225
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...

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.