Solved Problem Connecting to SQL Server

Spalle

New member
Local time
Today, 12:38
Joined
Dec 29, 2023
Messages
24
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: 140
  • Bild_2024-01-02_013033017.png
    Bild_2024-01-02_013033017.png
    11.8 KB · Views: 135
Think you would need to at least translate it? :(
 
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: 119
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().
 
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?
 
I can show you the code
 

Attachments

  • Bild_2024-01-02_231102349.png
    Bild_2024-01-02_231102349.png
    35.7 KB · Views: 107
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

Back
Top Bottom