Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error accessing file... 2

Status
Not open for further replies.

Pire

Technical User
Sep 29, 2002
13
0
0
US
Can anyone explain what might cause a "Error accessing file. Network Connection may have been lost" error?

The debugger takes me to this script:

Private Sub Command255_Click()
On Error GoTo Err_Command255_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_Command255_Click:
Exit Sub

Err_Command255_Click:
MsgBox Err.Description
Resume Exit_Command255_Click

End Sub

I also get it when trying to select a record using a combo box and debugger points to:

Private Sub Combo2303_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[PROJ_PKEY] = " & Str(Me![Combo2303])
Me.Bookmark = rs.Bookmark
End Sub

All of my tables are in the database. How can I get a network error?

Thanks,
Trent
 
First lose the dot in Recordset.Clone
It's RecordsetClone (just one word)

And replace the 2 DoMenuItem lines with just one line:

DoCmd.RunCommand acCmdDeleteRecord


Then...
That has nothing to do with the network. The connection between the VB project and the database was broken somehow (I guess not even Microsoft knows why). It's something that happened to me also, in the following situations (ordered by frequency):

1. Made a form with the wizard and then altered the code
2. Exported a form/report from another database into the current one
3. Renamed a form/report and created another one with the old name of the renamed object
4. (rare) Imported a form from another database
5. Circumstances that I couldn't recreate.


Copy the code in a txt file, then in your form's HasModule property say 'No'. Close and reopen the database and reimport the code behind that form.

Another fix (that does not always work, but it is worth trying):

Start-Run
msaccess.exe /decompile "C:\Path\File.mdb"

And for the future: keep all modules saved in txt files.
In this way you can delete all code and import it back in a clean VB project.

Needless to say, before you do anything of the above, backup you file.

HTH

[pipe]
Daniel Vlas
Systems Consultant

 
Great advice, Daniel! Sorry to take so long to respond. I've been on vacation.

I definitely think this is the right track. The circumstances you describe having trouble with fit exactly. Unfortunately none of these seem to work completely. The problem may have to do with one of the forms that I tried copying within the database to use as a development form instead of just copying the whole database. Now when I try to delete the development form from the objects window it appears to go away but it still appears as an object in the VB editor. What gives? Is there any way to get rid of that stupid thing completely?

btw I'm still giving you a star for the great assessment and advice. Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top