数据库意外关闭 [英] Database closes unexpectedly

查看:101
本文介绍了数据库意外关闭的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人知道为什么我的数据库有时会因为没有明显的原因自行关闭?我不认为它与我的代码有任何关系,因为作为关闭我的一个例子,我在带有子表单的表单上输入数据。我输入了大约15条记录的数据并且它工作得非常好,然后我像之前一样点击了下一条记录,整个数据库都关闭了。在我试图打开上面提到的子表单之前,我遇到了这个问题,但我发现它是由于表达式指的是主要表单(由于主表单不是'当时不开放。关于这个的任何想法?它出乎意料地发生,很难说是什么造成了问题,除了它总是与上面提到的形式有关。

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.

推荐答案

它刚刚再次做到了。我再次将数据输入到表单中,当我从一个字段切换到下一个字段时,Access中的状态栏表示正在计算...。然后关闭整个数据库。


如前所述,我使用的是主窗体(JobVacancy)和子窗体(JobVacancySubForm)。主要表单仅供参考,显示工作代码,职位,薪资等级,然后有三个文本框。

1. TotalPositions:计算可用职位总数:


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

其中NumberofPositions是JobVacancy表中的一个字段,Code是主表单上的作业代码(这个字段在子表单中更新)


2. TotalOccupants:具有此特定工作的员工总数作为其职位名称计算


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


其中MY - JobVacancy2是查询,JobVacancyMain是主要表格。


3. TotalVacancy:与此职位相关的职位空缺总数


= IIf((DSum(" [NumberofPositions]",[JobVacancy]",[code] = [JobVacancy]![JobCode]")) - (DCount(" MY - JobVacancy2]![ID]",&quo t; MY - JobVacancy2",[MY - JobVacancy2]![JobCode] = Forms![JobVacancyMain]![code]"))< 0,0,(DSum(" [NumberofPositions]"," ; [JobVacancy]"," [code] = [JobVacancy]![JobCode]")) - (DCount(" [MY - JobVacancy2]![ID]",MY - JobVacancy2," ; [MY - JobVacancy2]![JobCode] = Forms![JobVacancyMain]![code]")))

我把它放在if语句中,因为有些情况下员工多于职位(有时员工被终止但数据库尚未更新等)因此,我只想知道有0个职位空缺,而不是显示负数。

我的子表单,名为JobVacancySubForm,基于一个查询,有2个组合框,一个用于显示部门,另一个用于显示作业所在的部门。用户选择部门和部门,然后进入职位数。


我还有两个计算文本框:

1. CountofId:计算在主表单中显示特定职位的员工数量,并且位于子表单中的特定部门和部门(我应该提到子表单是连续的表单)


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


2. Number ofVacancies:计算此特定部门和部门的职位空缺数量


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


再次,我不想要显示负数。


我有一个感觉系统正在陷入这些计算陷入困境,这导致它意外关闭,所以如果有人有任何建议,我会非常感激!请记住,我之前从未在Visual Basic中编码,所以如果你的解决方案在哪里,请提供大量细节!
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 (JobVacancySubForm). 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("[NumberofPositions]","[JobVacancy]","[code]=[JobVacancy]![JobCode]")

where NumberofPositions 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("[NumberofPositions]","[JobVacancy]", "[code]=[JobVacancy]![JobCode]"))-(DCount("[MY - JobVacancy2]![ID]","MY - JobVacancy2","[MY - JobVacancy2]![JobCode]= Forms![JobVacancyMain]![code]"))<0,0, (DSum("[NumberofPositions]","[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 JobVacancySubForm, 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. NumberofVacancies: Calculates the number of vacancies in this particular department and division

=IIf(([NumberofPositions]-(DCount("*","MY - JobVacancy2","([MY - JobVacancy2]![JobCode]=Forms![JobVacancyMain]![code]) AND ([MY - JobVacancy2]![DivisionCode]= [JobVacancy]![DivisionCode])")))<0,0,([NumberofPositions]-(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!


嗯,计算不会导致这一般,但看起来你的数据库已经损坏。

尝试我的MS Access数据库恢复步骤:


1)创建一个备份腐败的数据库。 (以防万一)


2)创建一个新数据库并使用File / Get external data / Import来获取受损数据库的所有对象。


3)尝试以下Microsoft解决方案:

修复A97 / A2000:
http://support.microsoft.com/support.../Q109/9/53.asp

Jetcomp:
http: //support.microsoft.com/default...;en-us;Q273956

和/或阅读文章:

ACC2000:如何排除故障Microsoft Access数据库中的损坏
http://support.microsoft.com/default...b;en-us;306204


4)比特更重:

访问反编译:
http://www.granite.ab.ca/access/decompile.htm


5)尝试恢复工具/表救援

表数据恢复:
www.mvps.org/access/tables/tbl0018.htm

访问恢复:
http://www.officerecovery.com/access/index.htm


6)问一个公司(将花费
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


! )
http://www.pksolutions.com/services.htm


还检查: http://www.granite.ab.ca/access/corruptmdbs.htm


Nic; o)
''s ! )
http://www.pksolutions.com/services.htm

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


Nic;o)


这篇关于数据库意外关闭的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆