Access form stuck between open and load event

Hello,

I have an access form that stalls between the open and load events.  I put a message box in the open event of the form and it fires.  However the load event never fires.  I've commented out all the code within the load event as well as compacted and repaired the database.  The form was working fine earlier in the day.  This form is populated via a linked sql server table (view).  The view opens fine when I open it by itself. This is a Access 2007 database
Juan VelasquezAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
Run this procedure on your db: (and post the code in the Open event)


Open the VBA Editor and from the menu ...Tools>>References ....
If you see any listed as **Missing: <reference name>, including the asterisks and the word Missing, the
you need to fix that first.

Then, follow this procedure:

****
0) **Backup your MDB BEFORE running this procedure**
****
1) Compact and Repair the MDB, as follows:
Hold down the Shift key and open the MDB, then from the menu >>Tools>>Database Utilities>>Compact and Repair ...
Close the mdb after the Compact & Repair.
2) Execute the Decompile (See example syntax below) >> after which, your database will reopen.
3) Close the mdb
4) Open the mdb and do a Compact and Repair (#1 above).
5) Close the mdb.
6) Open the mdb:
    a) Right click over a 'blank' area of the database window (container) and select Visual Basic Editor. A new window will open with the title 'Microsoft Visual Basic' ... followed by then name of your MDB.
    b) From the VBA Editor Menu at the top of the window:
       >>Debug>>Compile
        Note ... after the word Compile ...you will see the name of your 'Project' - just an fyi.

7) Close the mdb
8) Compact and Repair one more time.

*** Executing the DeCompile **EXAMPLE**:
Here is an **example** of the command line syntax  (be SURE to adjust your path and file name accordingly) before executing the decompile:

Run this from Start>>Run, enter the following command line - **all on one line** - it may appear like two lines here in the post:
Also, the double quotes are required.

"C:\Program Files\Microsoft Office\Office\Msaccess.exe" /decompile "C:\Access2003Clients\YourMdbNameHERE.mdb"

For more detail on the Decompile subject ... visit the Master on the subject (and other great stuff) Michael Kaplan:

http://www.trigeminal.com/usenet/usenet004.asp?1033

AND ...
Once you get familiar with the Decompile idea (and ALWAYS make a BACKUP first!) ... you can add both Decompile and Compact/Repair to the Right Click menus in Windows Explorer, which I use multiple times daily:

Getting the Decompile and Compact context menu options
http://access.mvps.org/access/modules/mdl0039.htm

mx

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Juan VelasquezAuthor Commented:
Hello mx,

I went ahead and went through the procedure you posted.  I was able to get the application going to now see where it was hanging up.  The form seemed to hang up when it hit PopulateMainComboBoxes.  This is the procedure I use to populate the comboboxes at runtime

Private Sub Form_Load

 ClearComboBoxes
 '   PopulateMainComboBoxes
 '   LoadRetrieve

End Sub

Private Sub PopulateMainComboBoxes
   Dim cnn as ADODB.Connection
   Dim rst As ADODB.Recordset
   
    Set cnn = New ADODB.Connection
    On Error Resume Next
   
   
    cnn.ConnectionString = cStrOLEDBConnectionString
    cnn.ConnectionTimeout = 0
    cnn.Open
    Set rst = cnn.Execute("dbo.spRetrieveGFPList")
    rst.MoveFirst
    Do While Not rst.EOF
        Me.cmbFilterByGFP.AddItem Nz(rst!GFP, "")
        rst.MoveNext
    Loop
   
    Set rst = cnn.Execute("dbo.spRetrieveWorkStreamList")
    rst.MoveFirst
    Do While Not rst.EOF
        Me.cmbFilterByWorkstream.AddItem Nz(rst!WorkStream, "")
        rst.MoveNext
    Loop
   
   
rst.Close
cnn.Close
Set rst = Nothing
Set cnn = Nothing


End Sub
DatabaseMX (Joe Anderson - Microsoft Access MVP)Database Architect / Systems AnalystCommented:
ok ... so, where is ... it hanging up ?
Acronis True Image 2019 just released!

Create a reliable backup. Make sure you always have dependable copies of your data so you can restore your entire system or individual files.

peter57rCommented:
I don't know if it's the way you copied and pasted your code into the question, but you appear to have created subs that don't have  () at the end of their declaration.. I don't know how it is possible to do that.  Can you check that your actual code does have the () for both procedures.
Juan VelasquezAuthor Commented:
Yes I have () for both procedures.  One of the things I found was that I had the following line
On Error Resume Next
This was masking the actual problem which is a timeout error.  Upon further investigation, I found that the following stored procedure "dbo.spRetrieveGFPList" was running very slowly.  I'm now in the process of optimizing it.
Juan VelasquezAuthor Commented:
Hello DatabaseMX,

It is hanging up on
Set rst = cnn.Execute("dbo.spRetrieveGFPList")

I am getting a timeout error.  I then executed the stored procedure and it took 40 seconds to complete.  It returned 17 rows
Juan VelasquezAuthor Commented:
Thanks for the help on the decompile.  That really helped to get the form up and running enough so I could trouble shooting.  I optimized the query and then set the connection command timout to 300 .  That portion of the form is now running great.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.