PC Review


Reply
Thread Tools Rate Thread

CurrentProject.OpenConnection ignores default language

 
 
Simon Francesco
Guest
Posts: n/a
 
      11th Dec 2008
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
 
Reply With Quote
 
 
 
 
hassan
Guest
Posts: n/a
 
      15th Dec 2008

"Simon Francesco" <(E-Mail Removed)> wrote in message
news:34F42A02-CC5A-4B59-ABB2-(E-Mail Removed)...
> 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


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Default language in Word not same as default input language. Possi Asa_johannesen Microsoft Word Document Management 1 22nd May 2009 07:36 PM
FileDialog default to Application.CurrentProject.Path hwdperk Microsoft Access VBA Modules 3 27th Jan 2009 07:50 PM
Access 2007 CurrentProject.OpenConnection =?Utf-8?B?R3V5?= Microsoft Access ADP SQL Server 0 8th Aug 2007 02:10 AM
Help with CurrentProject.Path and CurrentProject.FullName Bill Davis Microsoft Access Form Coding 2 3rd Nov 2006 10:28 AM
CurrentProject.OpenConnection with VPN connections Lauren Quantrell Microsoft Access 1 2nd Dec 2004 08:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:53 AM.