Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

User Connect to Server

Discussion in 'Information Technology' started by Jim Bunton, Oct 27, 2005.

  1. Jim Bunton

    Jim Bunton
    Expand Collapse
    Guest

    Access97, win 2000

    I want to prompt a user to provide thier username and password to connect to an SqlServer

    This works
    *** Code Start ***
    Set conPubs = wrkODBC.OpenConnection("Connection1", _
    dbDriverPrompt, , _
    "ODBC;DATABASE=cnettestsqldb;UID=cnettestuser1;PWD=;DSN=")
    ** Code End **

    BUT
    the user is confronted with:


    If JayRemote is selected then the login dialogue is shown (see below)

    I want the user to see just the login screen without it being preceded by the select data source dialogue:




    SO
    I have amended the code to

    *** Code Start ***
    Set conPubs = wrkODBC.OpenConnection("Connection1", _
    dbDriverComplete , , _
    "ODBC;DATABASE=cnettestsqldb;UID=cnettestuser1;PWD=;DSN=JayRemote")
    ** Code End **

    RESULT runtime error 3146 - ODBC call failed

    I cannot find any 'option' which does not generate this error if I include the DSN in the connect string.

    The UID is NOT a Trusted Connection. It is an SQL Server UserId



    Jim Bunton
    13 Westbourne Road
    Trowbridge Wilts BA14 0AJ
    01225 765 541
    07919 283 968
     
  2. Loading...

    Similar Threads Forum Date
    After FIR, Social Media Users Wary of Offensive Jokes on Sardars Information Technology Oct 2, 2013
    USA US govt secretly collecting data on millions of Verizon users: Report Breaking News Jun 6, 2013
    using spiritual name as a username Questions and Answers Aug 23, 2012
    Audience of 3 Million Users Receiving Anti-Sikh Messages Hard Talk Sep 17, 2010
    General How can I change my username ? Hard Talk Sep 4, 2010

  3. David Lloyd

    David Lloyd
    Expand Collapse
    Guest

    Jim:

    First let me qualify that the following was done on Access 2003, therefore,
    it may not behave the same on Access 97. That being said, the following
    code generates the prompt for the username and password. The following also
    works with the dbDriverCompleteRequired parameter.

    Set cn = ws.OpenConnection("Test1", dbDriverComplete, False,
    "ODBC;DSN=TestSQL")

    The following KB article has some useful, general information regarding
    ODBCDirect workspaces.

    http://support.microsoft.com/default.aspx?scid=kb;en-us;164481


    --
    David Lloyd
    MCSD .NET
    http://LemingtonConsulting.com

    This response is supplied "as is" without any representations or warranties.
     
  4. Jim Bunton

    Jim Bunton
    Expand Collapse
    Guest

    Thanks for the reply David - unfortunatley still no joy!

    I want to display the Logon dialogue (see original posting)
    ACCESS97 Win 2000

    >>>>>CODE>>>>

    Public Sub PromptConnect()
    Dim WkspcODBC As Workspace, NewCon As Connection

    'Create ODBC workspace
    Set WkspcODBC = CreateWorkspace("NewODBCWorkspace", "admin", "", dbUseODBC)
    'Open New Connection to JayRemote
    Set NewCon = WkspcODBC.OpenConnection("Test1", dbDriverComplete, False, "ODBC;DSN=JayRemote")
    '> ERROR 3146 ODBC connection failed
    'The following which includes UID & PWDalso fails!
    'Set NewCon = WkspcODBC.OpenConnection("Test1", dbDriverComplete, _
    False, "ODBC;DSN=JayRemote;UID=myusername;PWD=mypassword")
    '> ERROR 3146 ODBC connection failed
    End Sub

    <<< CODE END <<<

    NOTE
    the ODBC driver JayRemote has Authentification set as "With SQL Server Authentification Entered by the user"


    "David Lloyd" <David@NoSpamPlease.com> wrote in message news:QTW7f.14838$x6.12019@bignews6.bellsouth.net...
    > Jim:
    >
    > First let me qualify that the following was done on Access 2003, therefore,
    > it may not behave the same on Access 97. That being said, the following
    > code generates the prompt for the username and password. The following also
    > works with the dbDriverCompleteRequired parameter.
    >
    > Set cn = ws.OpenConnection("Test1", dbDriverComplete, False,
    > "ODBC;DSN=TestSQL")
    >
    > The following KB article has some useful, general information regarding
    > ODBCDirect workspaces.
    >
    > http://support.microsoft.com/default.aspx?scid=kb;en-us;164481
    >
    >
    > --
    > David Lloyd
    > MCSD .NET
    > http://LemingtonConsulting.com
    >
    > This response is supplied "as is" without any representations or warranties.
    >
    >
     

Share This Page