简体   繁体   中英

Ms Access form linked to SQL Server unresponsive

Not sure if there is a definite answer for this, but I have an Ms Access application with SQL Server 2008 as data store all tables are linked to the SQL Server from the Access application, the application is hosted on a Citrix server. All the forms in the application are bound forms. There is one particular form that is lately causing issues when I try to edit or save the data the form hangs for ever and I have to kill the session. The form is linked to a table on SQL server and the table has Identity column as primary key, what I find weird is that this form is not even as heavily used as any other forms and the table does not even have half the records as any other heavily utilized tables. There are only 4 fields on the form with only one feild being Nvarchar, other forms have way more Nvarchar fields with way more utilization and data and they do not seem to cause any issues. I am ruling out Network issues as that would affect the entire application and not just one form also the indexes on the SQL server are build daily so I don't think it is an indexing issue either. Does any one know why this would happen.

Try rebuilding your Access front end. Create a new database, set your database-specific options to match (field behavior, auto name tracking off or on, SQL syntax level, etc.), then import all forms, reports, macros, vb code, and data from the old Access database into the new one. Set startup options properly, and see if anything is better.

Access databases can get subtly corrupted and a total rebuild is sometimes the only way to fix them.

Make sure you keep a backup.

If you suspect the form is corrupted you could use the SaveAsText and LoadFromText methods to save the form definition as a text file, then reload it with a different name.

Application.SaveAsText acForm, "frmMainMenu", "frmMainMenu.txt"
Application.LoadFromText acForm, "frmMainMenu_new", "frmMainMenu.txt"

Those methods aren't a comprehensive as Erik's suggestion, but they are quick and easy. You can also try decompile to fix corruption. See the 2 answers at this link: HOW TO decompile and recompile

If corruption is not the cause of the problem, you can try stepping through your form's code in break (debug) mode. Place a temporary break point on the first executable line in your form's open procedure. If you don't have a procedure for Form Open, add one. If you're unfamiliar with setting temporary break points, you can just add the word Stop :

Private Sub Form_Open(Cancel As Integer)
    Stop

Then after you open the form, you can step through the code one line at a time with the F8 key. Hopefully you will be able to identify the line which causes the code to hang.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM