Results 1 to 2 of 2
  1. #1
    Join Date
    Oct 2005

    Unanswered: Not a valid user for the Database

    I've had an Access app running for somewhat over 3 months now, that has a small search feature looking up records in a SQL server database and adds them to the local Access database.

    Its been working nicely until just yesterday, where the program does either nothing or reports that the user isn't a valid user for the database Grip.

        Dim udvalg As ADODB.Recordset
        Set udvalg = New ADODB.Recordset
        Dim forbindelse As ADODB.Connection
        Set forbindelse = New ADODB.Connection
        Dim sql As String
        sql = "SELECT * FROM md_vw_gripinfo WHERE gripid = " & Str(box_grip.Value)
        forbindelse.Open "PROVIDER=SQLOLEDB;SERVER=DBServer;DATABASE=Grip_UDV;User ID=Test;Password=test"
        Set udvalg.ActiveConnection = forbindelse
        udvalg.Source = sql
        udvalg.Locktype = adLockReadOnly
        udvalg.CursorLocation = adUseServer
        'Set the form's Recordset property to the ADO recordset
        Set Me.subform_udvalg.Form.Recordset = udvalg
        Set udvalg = Nothing
        Set forbindelse = Nothing
    The awkward bit is that (if you notice) the database I'm using is called Grip_UDV (which is a developer edition of the Grip database) while the connection tries to access Grip instead.

    If I try logging into the SQL-server using query analyzer using the user ID TEST and password TEST, it defaults to Grip_UDV and selects without a hiitch.

    So I don't know where to from there.

    ANy ideas?

    IT squid: networks, servers, firewalls, routers and I dabble a little with SQL-server and Access as well....

  2. #2
    Join Date
    Mar 2003
    The Bottom of The Barrel
    Provided Answers: 1
    I believe you should be using "INITIAL CATALOG" as opposed to "DATABASE" and "DATA SOURCE" instead of "SERVER".

    You're trying to use ODBC parameters in an OLE DB connection string...
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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