Solved Problem Connecting to SQL Server (1 Viewer)

Spalle

New member
Local time
Today, 01:13
Joined
Dec 29, 2023
Messages
22
Hello Everyone,

I am currently facing an issue with the ODBC connection to my SQL Server. While it functions perfectly on my personal computer, it encounters difficulties on my coworkers' PCs.
They have successfully set up the ODBC connection on their machines, and creating a new database and connecting, viewing and editing the data poses no problem. However, they are unable to establish a connection with the frontend.
The error message displayed is shown in the attached image. Upon clicking "OK," they encounter the SQL Server Registration Popup (refer to image 2).
I am hopeful that someone may be familiar with this issue.

thanks in advance :)
 

Attachments

  • Bild_2024-01-02_012942791.png
    Bild_2024-01-02_012942791.png
    15.4 KB · Views: 57
  • Bild_2024-01-02_013033017.png
    Bild_2024-01-02_013033017.png
    11.8 KB · Views: 56

Gasman

Enthusiastic Amateur
Local time
Today, 00:13
Joined
Sep 21, 2011
Messages
14,310
Think you would need to at least translate it? :(
 

Spalle

New member
Local time
Today, 01:13
Joined
Dec 29, 2023
Messages
22
Yes of course,
It says:
Error while connecting
SQLState: S1000
SQLServer Error:0
Microsoft ODBC SQL Server Driver(Cannot generate SSPI Context

i think it is this error on english
 

Attachments

  • IMG_0282.png
    IMG_0282.png
    24.3 KB · Views: 35

Spalle

New member
Local time
Today, 01:13
Joined
Dec 29, 2023
Messages
22
Alright, I've managed to find a workaround for the error. I believe the issue stemmed from my connection to the database using Microsoft Authentication, whereas my coworkers used a password. To address this, I created a loop that iterates through all tables, deletes them, and then recreates and reconnects them. This approach has proven effective.

However, a challenge has surfaced. I utilize db.TableDefs (after initializing db = CurrentDb()), but it doesn't provide a complete list of all tables in the Access Frontend. Some tables are missing, while others appear duplicated. I'm unsure about what might be incorrect in my use of db = CurrentDb().
 

xavier.batlle

New member
Local time
Today, 01:13
Joined
Sep 1, 2023
Messages
22
However, a challenge has surfaced. I utilize db.TableDefs (after initializing db = CurrentDb()), but it doesn't provide a complete list of all tables in the Access Frontend. Some tables are missing, while others appear duplicated. I'm unsure about what might be incorrect in my use of db = CurrentDb().
Do you assign or reassign Set db=CurrentDb() after reconnecting SQL server tables?
 

Spalle

New member
Local time
Today, 01:13
Joined
Dec 29, 2023
Messages
22
I can show you the code
 

Attachments

  • Bild_2024-01-02_231102349.png
    Bild_2024-01-02_231102349.png
    35.7 KB · Views: 34

xavier.batlle

New member
Local time
Today, 01:13
Joined
Sep 1, 2023
Messages
22
I can show you the code
I think the problem is that in your For Each tdf In dbs.Tabledef loop, you delete the tabledef (dbs.TableDefs.Delete) before you create the new link ,and when you delete an item all tabledef elements in dbs are renumbered. Because of this, it seems there are missing and duplicated tables.
You should try a different approach, for example:
- tblDef.RefreshLink instead of deleting and creating the link
Or create a loop from the max value to 0 like this:
Code:
    For I = M_Db.TableDefs.Count - 1 To 0 Step -1
        If Len(M_Db.TableDefs(I).Connect) Then
            M_Db.TableDefs.Delete M_Db.TableDefs(I).NAME
           ' Link the table
            ----
        
        End If
    Next I
 
Last edited:

Users who are viewing this thread

Top Bottom