Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2003
    Location
    México
    Posts
    2

    Unanswered: How can I avoid to display the default database connection screen using DAO?

    I'm programing my own login screen for my database application (VB6), when the program starts, this login screen appears and retrieves the information about user name and password to connect to the database, but, if this information is wrong, before my error handler show any exception, the default database connection screen appears and let the user retry to connect to the database, that's the screen that I need to avoid show to the user. Somebody can help me?

    Here is the code (part):

    On Error Goto Error_Handler
    .
    .
    .
    Set Cnt = DBEngine.OpenDatabase("pubs", dbDriverNoPrompt, False, "ODBC;DSN=pubs;UID=" + sUser + ";PWD=" + sPwd) 'If this call fails, the program shows the default login screen and let the user retry
    .
    .
    .
    Exit Sub
    Error_Handler:
    MsgBox "<Error>"
    Resume Next

  2. #2
    Join Date
    Jan 2003
    Location
    Dordrecht, The Netherlands
    Posts
    95
    I have solved this problem in Access VBA by first creating a ODBCDirect Workspace wspODBC and then call the OpenConnection method:

    Dim wspODBC As Workspace, conODBC As Connection
    Dim strConnect As String

    strConnect="...." 'You obviously know what to put in there

    Set wspODBC = DBEngine.CreateWorkspace("ORCL","Admin","",dbUseOD BC)

    Set conODBC = wspODBC.OpenConnection("ORCL", dbDriverNoPrompt, False, strConnect)

    etc.

  3. #3
    Join Date
    Feb 2003
    Posts
    4
    I have created my own login boxes, albeit to Oracle databases. However I used data environments (picked up someone elses project). But in there I had to set the connection RunPromptBehaviour to adPromptNever.

    Therefore you might be able to access the attribute for a code-defined connection and set the prompt.

    Once it was set to false, I was able to use my box primarily

    Good Luck,
    Daniel

Posting Permissions

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