Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267

    Unanswered: Suppress SQL Server Errors

    To All--

    I'm using DoCmd.TransferDatabase to dynamically link to some SQL Server tables on the fly. If I'm not able to connect to the table I don't want the SQL Server to popup some dialog box. I would like to handle the error internally and not display the dialog box(es). Does any one know how to turn off these dialog boxes from SQL Server? Thanks.

    C

  2. #2
    Join Date
    Nov 2010
    Posts
    84
    Dim TableName As String
    Dim ConectString As String
    Dim ServerName As String
    Dim UserName As String
    Dim Password As String
    Dim DataBaseName As String

    ServerName = "aaaaa"
    UserName = "sa"
    Password = ""
    DataBaseName = "bbbb"
    TableName = "ccccc"

    ConectString = "ODBC;DRIVER=SQL Server;SERVER=" & ServerName & ";UID=" & UserName & ";PWD=" & Password & ";DATABASE=" & DataBaseName & ";Trusted_Connection"

    DoCmd.TransferDatabase acLink, "ODBC Database", ConectString, acTable, TableName, TableName, , True

  3. #3
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Thanks but I know how to link to the table. What I'm wondering is if anyone knows how to stop the error messages displaying if say maybe the user supplied the wrong password.

    C

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If you open a connection using the OpenConnection method of a DAO.Workspace object, there are optional parameter (dbDriverNoPrompt, dbDriverComplete, dbDriverCompleteRequired) that seem to do just that. See Access Help on OpenConnection for more info.
    Have a nice day!

  5. #5
    Join Date
    Jul 2004
    Location
    South Dakota
    Posts
    267
    Thanks that works perfect!!!!

Posting Permissions

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