Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2002

    Unhappy Unanswered: Access to SQL 2000 problem

    Dear all,

    i have developed an access application for a sql backend database, and this error message:

    connection failed: SQLState: '28000' SQL Server Error: 18452 [Microsoft][ODBC SQL Server Diver[SQL Server]]login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

    keep popping up everytime i access SQL for the first time.

    i know this is the login parameters, which i can wait for it to query me about it, however, to ease the users, is there a way for me to code it so i can open up a input box to allow users to enter the parameters?

    i am using link tables in access to get to the data in the sql database.

    how can i get around this? many thanks

  2. #2
    Join Date
    Mar 2004

    Re: Access to SQL 2000 problem

    To Prompt user for username and password do this:

    Dim cn as ADODB.Connection
    Dim rs as ADODB.Recordset

    Set cn = new ADODB.Connection

    'To Prompt user for username and password

    cn.Provider = "sqloledb"
    cn.Properties("Prompt") = adPromptAlways
    cn.Open "Data Source=myServerName;" & _
    "Initial Catalog=myDatabaseName"

    set rs = new ADODB.recordset

    rs.ActiveConnection = cn

    rs.Open "Select * From Table"



    Set rs=Nothing
    Set cn = Nothing

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts