CurrentProject.OpenConnection ignores default language

  • Thread starter Thread starter Simon Francesco
  • Start date Start date
S

Simon Francesco

It appears to me that the CurrentProject.Connection object ignores the SQL
Login's default language setting when using an ADP project.

If I execute the two pieces of code below I get different results.
I use a login form that calls CurrentProject.OpenConnection, but the
resultant CurrentProject.Connection dis-respects the SQL default language of
the user.
Can anyone tell what I am doing wrong or confirm that the OpenConnection
method has a bug.

Sub TestLanguage(useConnectionObject As Boolean)

Dim cn As ADODB.Connection
If useConnectionObject Then
Set cn = CurrentProject.Connection
Else
Set cn = New ADODB.Connection
cn.ConnectionString = CurrentProject.Connection.ConnectionString +
";Password=tes7Ing"
cn.Open
End If

Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT @@Language")

Debug.Print rs(0)
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

End Sub

TestLanguage(False)
British 'CORRECT
TestLanguage(True)
us_english 'INCORRECT


TIA
Simon
 
Simon Francesco said:
It appears to me that the CurrentProject.Connection object ignores the SQL
Login's default language setting when using an ADP project.

If I execute the two pieces of code below I get different results.
I use a login form that calls CurrentProject.OpenConnection, but the
resultant CurrentProject.Connection dis-respects the SQL default language
of
the user.
Can anyone tell what I am doing wrong or confirm that the OpenConnection
method has a bug.

Sub TestLanguage(useConnectionObject As Boolean)

Dim cn As ADODB.Connection
If useConnectionObject Then
Set cn = CurrentProject.Connection
Else
Set cn = New ADODB.Connection
cn.ConnectionString = CurrentProject.Connection.ConnectionString +
";Password=tes7Ing"
cn.Open
End If

Dim rs As ADODB.Recordset
Set rs = cn.Execute("SELECT @@Language")

Debug.Print rs(0)
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing

End Sub

TestLanguage(False)
British 'CORRECT
TestLanguage(True)
us_english 'INCORRECT


TIA
Simon
 
Back
Top