Solved Error Number: 3011 (1 Viewer)

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
Hi all,

I have just started receiving an error message with a linked table. It has only appeared today and the related FE still works fine using this table.

Error 3011.png


I am still able to open and access the table and all queries and code related to it work.

Has anyone ever had anything similar?

~Matt
 

GPGeorge

Grover Park George
Local time
Today, 14:20
Joined
Nov 25, 2004
Messages
1,877
Where and when does the error appear? In a VBA procedure?
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
Where and when does the error appear? In a VBA procedure?
As soon as I open the FE. The database opens a main form and then this error appears.

There are lots of linked tables and this is the only one that has an issue.

~Matt
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:20
Joined
Sep 21, 2011
Messages
14,317
And the table is still called tblEmployees?
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
Update.

I have this FE linked to 2 BEs and the error is linked to the only table from the secondary BE. All the others tables are from the main BE and they all work fine.

~Matt
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
And the table is still called tblEmployees?
Hi Gasman,

It is yes. And the table works fine in other FEs. Despite the error message, the table still opens and works fine, as does the code I am using the table for (User Access Rights)

~Matt
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
Further Update

If I remove the option from Display Form, the error does not happen. But if I select a Display Form (any form), the error appears.

~Matt
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:20
Joined
Feb 28, 2001
Messages
27,192
Sounds like something is being late-bound and the reference to it occurs before the binding of it. Tables that are statically bound based on the stored connect string at startup don't do this, but tables that you dynamically reload don't connect at startup.
 

MattBaldry

Self Taught, Learn from the Forums
Local time
Today, 22:20
Joined
Feb 5, 2019
Messages
293
I have found the issue. The original programmer had a module called RefreshTableLinks that ran when every form is opened.

I have removed the call for this and all forms now open fine. If I never change the details or location of the linked tables, hopefully this will not cause an issue?

Code:
Public Function RefreshTableLinks() As String

Dim remembered_path As String

On Error GoTo ErrHandler
    Dim strEnvironment As String
    strEnvironment = GetEnvironment

    Dim db As DAO.Database
    Dim tdf As DAO.TableDef

    Dim strCon As String
    Dim strBackEnd As String
    Dim strMsg As String

    Dim intErrorCount As Integer

    Set db = CurrentDb

    'Loop through the TableDefs Collection.
    For Each tdf In db.TableDefs

            'Verify the table is a linked table.
            If Left$(tdf.Connect, 10) = ";DATABASE=" Then

                'Get the existing Connection String.--
                strCon = Nz(tdf.Connect, "")

                'Get the name of the back-end database using String Functions.
                strBackEnd = Right(strCon, (Len(strCon) - 10))

                'Debug.Print strBackEnd

                'Verify we have a value for the back-end
                If Len(strBackEnd & "") > 0 Then
                      
                    If Len(remembered_path) = 0 Then
                    '----------------------------------------------------------------
                         Dim res As Boolean
                         res = path_exists(strBackEnd)
                        
                         If res = False Then
                            strBackEnd = getBackEnd_new_location
                            
                            If Len(strBackEnd) = 0 Then
                              DoCmd.Quit
                            Else
                              remembered_path = strBackEnd
                            End If
                        
                         Else
                             remembered_path = strBackEnd
                         End If
                    '-----------------------------------------------------------------
                    End If


                    'Set a reference to the TableDef Object.
                    Set tdf = db.TableDefs(tdf.NAME)
                    tdf.Connect = ";DATABASE=" & remembered_path


                    'Refresh the table links
                    tdf.RefreshLink

                End If

            End If

    Next tdf

ErrHandler:

 If Err.number <> 0 Then

    'Create a message box with the error number and description
    MsgBox ("Error Number: " & Err.number & vbCrLf & _
            "Error Description: " & Err.Description & vbCrLf)

End If

End Function

~Matt
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:20
Joined
Feb 28, 2001
Messages
27,192
If I never change the details or location of the linked tables, hopefully this will not cause an issue?

Probably should work OK. I say "probably" and not "certainly" because if someone was previously dorking around with table links, you never know if there is a lurking remnant of that behavior to reach out and grab you. But at least you understand what was happening with the dynamic table re-linking. If it happens again, you have an idea of what might cause it this time and can search for re-linking behavior.
 

Gasman

Enthusiastic Amateur
Local time
Today, 22:20
Joined
Sep 21, 2011
Messages
14,317
I would be curious as to why that table and why now?
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 16:20
Joined
Feb 28, 2001
Messages
27,192
If the problem started on a Wednesday, blame it on a Microsoft Patch changing something having to do with SMB protocols. (That's usually a good excuse.)

EDIT: That's half-joke, half-not - because MS publishes patches and distributes them on every other Tuesday night. Learned that from the U.S. Navy job.
 

Users who are viewing this thread

Top Bottom