Question Supressing error msg "3043 - Disk or network error" (1 Viewer)

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
(Solved) Supressing error msg "3043 - Disk or network error"

(This issue has been resolved)

Hi there,

We're using a couple of networked Access DBs for client data capturing, and the error 3043 - Disk or network error has been costing us lots of man hours. After giving up on resolving the actual issue (our dept. is a very small part of the entire organization, and the entire network has it's hours when things are going really slow) I've come up with a work-around that in the case of network faliure saves the data to a temporary table, restores the connection and updates the BE.

However, after successful completion, the error message pops up as always, and I'd like to supress it not to confuse the users too much. A simple error handler doesn't seem to take care of it (the data restoration process is actually invoked by te Form_Error handler). Does anyone know how I should go about to solve this?

Thanks,
Gustav Friden
 
Last edited:

NigelShaw

Registered User.
Local time
Today, 21:58
Joined
Jan 11, 2008
Messages
1,573
Hi,

this might work.

in your error handler, create a select case statement. in the statement, have the error 3043 as a case. create the condition that you want if the error appears?

( i cant think how to word it at present but i will post back with a definative answer )
nigel
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
Hi there NigelShaw, and thanks for your reply.

I tried it first in the Form_Error (which triggers the external restore subroutine), but as the error occurs before coming to Form_Error, Err.Number shows 0. Perhaps I need to figure out exactly where it's triggered (so far I only know it's not in Form_Current) to cancel out the message before calling the routine. I'll do some trial-and-error and see if I can catch it in action =).

Thanks,
Gustav
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
Solved: Supressing error msg "3043 - Disk or network error"

Hrm,

From the MS Access help on OnError event:

Private Sub object_Error(DataErr As Integer, Response As Integer)

...

Response The setting determines whether or not an error message is displayed. The Response argument can be one of the following intrinsic constants.

Constant Description
acDataErrContinue Ignore the error and continue without displaying the default Microsoft Access error message. You can supply a custom error message in place of the default error message.

Simple sollution, and I've spent so much time SFTW that I complete forgot to RTFM... :rolleyes:

Thanks again for your time and help, NigelShaw!
 

mattsmusicpage

New member
Local time
Today, 16:58
Joined
Oct 7, 2005
Messages
8
Phil. I actually had the same problem. I was trying to create a work-around where the data would be saved to a temporary table on the FE of the database, and then reconnect to the BE, and copy that data from the temporary table to the BE again. I couldn't get it to work properly though.

For starters, I couldn't save the data to a temporary table properly. It always wanted to actually copy the data from the BE table, rather than copy it from the text box.

Second, I could not reconnect to the BE.

Third: I couldn't get far enough to copy the temporary table back to the BE.

Please please help with your code? Could you share?
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
Hi there Matt,

I'll be happy to help out, I'm out of town this week though, will post the code as soon as I return.

I the meantime, I'll give you a few pointers:

- The temporary tamble should be an exact copy of the BE one. That way you can just loop through the temp table copying all the data.
- when you copy the data, make sure you set me.txtTextBox as source, e.g. rstMyTempTable!strMyString = me.txtTextBox
- the code to copy the temp data into the BE, you'll need to close the current form, thus resetting the connection to the linked table. So in the last line of the Form_Error sub, launch a module containing the restoration (which in its first line could close the form).

Hope this helps a bit. Again, I'll post the code this weekend.

Regards
 

mattsmusicpage

New member
Local time
Today, 16:58
Joined
Oct 7, 2005
Messages
8
OK. I look forward to seeing the code. So the only way to reset the link to the table is by closing the form and reopening it? There's no code to re-establish the link on the fly? I've tried using the code that updates linked tables and it stays stuck in the network error.

I want to say I've tried using the text box as the source for the temporary table, and in testing it seemed it would sometimes copy the newest version, but sometimes it would still be trying to pull from the server. It's tough to test when the network error is so intermittant (I tested it by pulling out the ethernet cable). I look forward to how you've fixed this seemingly impossible problem (the workaround that is).

P.s. our system is access 97 based. For the life of me, I still can't figure out why it happens when it does. Some of the databases never get the error. Some get it more often than others. Weird!
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
Hi again Matt!

Sorry for getting back to you a bit later that I said, but what with Christmas and all... Now that I’m tired of all the food, let’s have a look at this:

You seem to suffer the same problems we did – we had to replace a box since it was failing so much (and therefore causing corruption in some cases), and whenever network load is at it’s max, the more user-intense DBs _will_ fail – thus this work around.

Ok, so restoring data after 3043 - Disk or Network error has got a few steps to it, plus there are two different scenarios: Updated record and New.

In the case of an update, you do (or I have done so, anyway):

1) Connect to a local, exact copy of your linked table(s)
2) Run through all the bound controls in your form to copy the data
3) Close the form(s) bound to the linked tables
4) Copy the data from the local to the linked table(s)
5) Open the form (and, if you wish, show the record that was being edited)

If the record is new, I’ve noticed you have to stop all running code between step 3 and 4. I did this launching a form with a button for the user to press, which invokes steps 4 and 5.

Note aswell these points:

This error won’t show the instant it occurs, but rather when a function (for example an cmbMyCombo_AfterUpdate is launched. If there is no error handler in that function, the Form_Error will take over. If not, you’ll have to include the Error number 3043 in that functions error handler to pass it on to Form_Error (or the function invoked by that).

If the form isn’t dirty, the code won’t launch, it’ll just disconnect (showing the ol’ #Name? in all controls. I guess one could detect that aswell though, and as we’re speaking about a linked table with a local FE, simply doing a Me.Recordset = Me.Recordset – haven’t tried it myself still though).

My tables are:
tblMerchants – linked table
tblLocalMerchants – local (empty) table, exact copy of the BE one

My forms:
frmMerchantSetup – the form where we capture customer data
frmRecuperate – the form mentioned above for new records.

My module:
mStartUp

The intID field is the Autonumber, in the form that’s txtID

I actually have a table for addresses as well, but I’ve left if out in this code, as that part takes up so many lines.

First, restoring:

In the active form, the code would look something like this:


Code:
[FONT=Arial][COLOR=blue][COLOR=blue][FONT=Arial]Private Sub Form_Error(intErr As Integer, intResponse As Integer)[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   Dim rstRescueMerchants As DAO.Recordset[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim frmCurrent As Form[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim objField As Object[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   If intErr = 3043 Then[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       intResponse = acDataErrContinue [/FONT][/COLOR][COLOR=gray][FONT=Arial]'this tells Access to supress the error message. If left out, Access will run all the code, and then show the message.[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]       'The local table we're going to save to:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       Set rstRescueMerchants = CurrentDb.OpenRecordset("SELECT * FROM tblLocalMerchants;")[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]       'our Form[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       Set frmCurrent = Forms!frmMerchantSetup[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       MsgBox "Connection Failed, will try to restore..."[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]       'We'll have to write to the local table:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       rstRescueMerchants.AddNew[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       For Each objField In frmCurrent [/FONT][/COLOR][COLOR=gray][FONT=Arial]'For each control in our form:[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]           'Let's omit unbound listboxes and lables:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]           If Not objField.Name Like "lst*" And Not objField.Name Like "lbl*" Then[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]               On Error Resume Next[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]               'Populate the fields:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]               rstRescueMerchants(objField.ControlSource) = objField[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]           End If[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       Next objField[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]       'Save and close:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       rstRescueMerchants.Update[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       rstRescueMerchants.Close[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]       'Call external function to close form, write the data[/FONT][/COLOR]
[COLOR=gray][FONT=Arial]       'in the local table to the networked one and finally[/FONT][/COLOR]
[COLOR=gray][FONT=Arial]       'open the form to restore Business As Usual:[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       Call mStartup.subRestartForm(Me.txtID)[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   End If[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   'DoCmd.SetWarnings False[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]End Sub[/FONT][/COLOR]
[/COLOR][/FONT]


Now that we’ve copied the data to the local table, we have to close the current form (plus any other form that uses the linked table), in order to restore the connection. We’ve already called the external function in the above code:

Code:
[FONT=Arial][COLOR=blue][COLOR=blue][FONT=Arial]Public Sub subRestartForm(intID As Integer)[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]   ‘First, close the form(s) that connect to the linked tables:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   DoCmd.Close acForm, "frmMerchantSetup"[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   Dim rstReal As DAO.Recordset[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim rstRescue As DAO.Recordset[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim intLoop As Integer[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim intNewID As Integer[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]   ‘Open the linked table, show only the record we were previously working on:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   On Error Resume Next[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Set rstReal = CurrentDb.OpenRecordset("SELECT * FROM tblMerchants WHERE (((intID) = " & intID & "));")[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]   ‘If we were working on a new record, there will be no match. Open recuperation form[/FONT][/COLOR]
[COLOR=gray][FONT=Arial]   ‘and stop all code:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   If Err.Number <> 0 Then[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       DoCmd.OpenForm "frmRecuperate"[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       Exit Sub[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   End If[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRescue.MoveFirst[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Set rstRescue = CurrentDb.OpenRecordset("SELECT * tblLocalMerchants;")[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       rstReal.MoveFirst[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       rstReal.Edit[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   intNewID = rstReal!intID[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   For intLoop = 1 To 150 Step 1[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]       On Error Resume Next[/FONT][/COLOR]
[COLOR=gray][FONT=Arial]       ‘Where user had updated field, update linked table with recuperated data:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       If rstReal(intLoop) <> rstRescue(intLoop) Then[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]           rstReal(intLoop) = rstRescue(intLoop)[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       End If[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Next intLoop[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]   ‘Update and save data:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstReal.Update[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstReal.Close[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRescue.Close[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   DoCmd.SetWarnings False[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   DoCmd.RunSQL "DELETE FROM tblLocalMerchants"[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   DoCmd.SetWarnings True[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]   ‘Open form again[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   DoCmd.OpenForm "frmMerchantSetup"[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]set rstReal = Nothing[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]set rstRescue = Nothing[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]End Sub[/FONT][/COLOR]
[/COLOR][/FONT]



The following part resides in frmRecuperate:

Code:
[FONT=Arial][COLOR=blue][COLOR=blue][FONT=Arial]Private Sub btnRestore_Click()[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   Dim rstRealMerchants As DAO.Recordset[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim rstRescueMerchants As DAO.Recordset[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim intLoop As Integer[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Dim intNewID As Integer[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]‘Connect the tables:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Set rstRealMerchants = CurrentDb.OpenRecordset("SELECT * FROM tblMerchants;")[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Set rstRescueMerchants = CurrentDb.OpenRecordset("SELECT * FROM tblLocalMerchants;")[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]‘Start writing the record:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRealMerchants.AddNew[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   For intLoop = 1 To 150 Step 1[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       On Error Resume Next[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]       rstRealMerchants(intLoop) = rstRescueMerchants(intLoop)[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Next intLoop[/FONT][/COLOR]
 
[COLOR=gray][FONT=Arial]‘Update and close and delete temporary data, and finally launch form:[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRealMerchants.Update[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRealMerchants.Close    [/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   rstRescueMerchants.Edit[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRescueMerchants.Delete[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   rstRescueMerchants.Close[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   Set rstRescueMerchants = Nothing[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   Set rstRealMerchants = Nothing[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]   DoCmd.OpenForm "frmMerchantSetup"[/FONT][/COLOR]
[COLOR=blue][FONT=Arial]   DoCmd.Close acForm, "frmRecuperate", acSaveNo[/FONT][/COLOR]
 
[COLOR=blue][FONT=Arial]End Sub[/FONT][/COLOR]
[/COLOR][/FONT]

Again, it's not a sollution, but in our case change (to the network infrastructure) is slow and this way we've managed to save thousands, so I'm quite happy with the sollution - and I hope it'll do for you aswell.

Good luck!
 

mattsmusicpage

New member
Local time
Today, 16:58
Joined
Oct 7, 2005
Messages
8
OK. I tried your first round of code (Just copying the data to the local table). I got several errors I cannot figure out. I kept playing with it and then later checked the local table. It did copy everything once, but I couldn't tell which time I played with the code that made it work. Any ideas? Here's my errors:

If I run the first round of code, just to copy the data to the local drive as you instructed, it gives me this error:



If I have this within the Private Sub (intErr As Integer, intResponse As Integer) then

Then it gives me a compile error, argument not optional:



I removed those items and commented out the interr and intresponse functions. I then get this error:



Run-Time error 3265, Item not found in this collection:

On debug: rstRescueMerchants(objField.ControlSource) = objField is highlighted.
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
From where is the code launched? If it's from another sub's or function's error handler, you'll have to pass the two parameters:

Call Form_Error(Err.Number, 0)

For the second error, did you remove the On Error Resume Next?
Thing is I got the same msg, but it won't (shouldn't) affect controls with a control source and a value.
 

mattsmusicpage

New member
Local time
Today, 16:58
Joined
Oct 7, 2005
Messages
8
OK. I'm almost there. The problem is, after you click the msg box saying "connection lost, trying to repair", another box pops up saying "Object doesn't support this property or method." I've tried the On Error If Err=(I think it's 438) as that error message, and that doesn't suppress the error.

The problem is, I have to use my own design to repopulate the data to the server. It's not as efficient, but it works. I'm not as advanced and had other errors with your coding on the second step. If I can suppress the above error message, everything will work perfect. If I can't, then based on the way I redesigned things to repopulate data (using forms on timers), the timer will run before a person clicks the error message.

Am I making any sense. Ultimately, I just need a way for it to not pop the message box and ignore the error for "Object doesn't support this property or method"
 

philosofe

Registered User.
Local time
Today, 21:58
Joined
Nov 1, 2008
Messages
20
Hi Matt!

That error (438) ocurrs for objects that don't have a .ControlSource, for example a button. I did have that problem when first writing that piece of code, but with the On Error Resume Next it was solved. Of course, in the preceeding IF-statement you could easily add And Not objField.Name Like "cmd*" and any other prefix of objects that wouldn't be bound to anything.

I don't know why you keep getting that message though (again, the above mentioned line _should_ supress any error msgs) - could you post the code the way it's present in you form now?

Thanks
 

mattsmusicpage

New member
Local time
Today, 16:58
Joined
Oct 7, 2005
Messages
8
OK. I tried what you said, and added all the not commands to cover the text boxes. I'm pretty sure I got all of them. see code below. So now, instead of that object error, I just get a blank microsoft access msgbox. Once again, if I dont click OK right away, the rest of the code still runs, and then an error happens (it thinks the network isnt connected again. I am testing the error by unplugging the ethernet cable on the machine, running the code of hte error, then plugging it back in. It's plugged in before the code runs, but things are still messing up). See attachment for the new error box.

I also tried just using regular code, rather than the object command you had

rstrescuemerchants!docnum=frmcurrent!docnum

when I ran that code, I would get the Disk or Network error and couldn't suppress that. WEird!

Private Sub Form_Error(Err As Integer, Response As Integer)
Dim rstRescueMerchants As DAO.Recordset
Dim frmCurrent As Form
Dim objField As Object

If Err = 3043 Then

Response = acDataErrContinue 'this tells Access to supress the error message. If left out, Access will run all the code, and then show the message.

'The local table we're going to save to:
Set rstRescueMerchants = CurrentDb.OpenRecordset("SELECT * FROM tbl_Report_Main_Local;")

'our Form
Set frmCurrent = Forms!frm_Rpt_Main

MsgBox "Connection Failed, will try to restore..."

'We'll have to write to the local table:

rstRescueMerchants.AddNew
rstRescueMerchants!dateoferror = Now()

For Each objField In frmCurrent 'For each control in our form:

'Let's omit unbound listboxes and lables:
If Not objField.Name Like "lst*" And Not objField.Name Like "lbl*" And Not objField.Name Like "command*" And Not objField.Name Like "btn*" And Not objField.Name Like "spell3" And Not objField.Name Like "DupRecord" And Not objField.Name Like "Save_Inc" And Not objField.Name Like "Del_Inc" And Not objField.Name Like "PreviewIncident" And Not objField.Name Like "Print_Report" And Not objField.Name Like "SendtoRMS" And Not objField.Name Like "close" And Not objField.Name Like "valuetemp" And Not objField.Name Like "label*" And Not objField.Name Like "lastTab" And Not objField.Name Like "autocreated" And Not objField.Name Like "Text*" And Not objField.Name Like "hiddeninclist" And Not objField.Name Like "box*" Then
' If objField.Name Like "DocNum" Then

'Populate the fields:

On Error Resume Next


rstRescueMerchants(objField.ControlSource) = objField


End If

Next objField
Forms!frm_Menu!tempdocnum = rstRescueMerchants!DocNum
'Save and close:

rstRescueMerchants.Update


rstRescueMerchants.Close

'Call external function to close form, write the data
'in the local table to the networked one and finally
'open the form to restore Business As Usual:

'replace this later for 2nd step: Call mStartup.subRestartForm(Me.txtID)
Call Newone1
End If


'DoCmd.SetWarnings False
End Sub
 

Attachments

  • untitled2.gif
    untitled2.gif
    14 KB · Views: 238

Rainbows8

New member
Local time
Today, 15:58
Joined
May 3, 2014
Messages
6
Hi All,

I am no programmer, but I do have a lil knowledge, and I too am having this issue with my BE mdb. I have been Googling this issue over and over, and to no avail, and it's frustrating as ****:banghead:. Today, I found this article from MS (knowledge base article 160907: Mastering Series: Run Time Error 3043 Disk or Network Error)....I honestly do not know if this solution will work, but it's worth a try. It says to create a Temp folder in C:\

So C:\Temp.

Please let me know if it works for you.
 

Users who are viewing this thread

Top Bottom