Results 1 to 3 of 3
  1. #1
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Access DSN Setup (97)

    I supply a database application to a client. The application is split FE & BE, both in Access 97 format. On occasion I update the BE with structural changes, and I have been doing this via a standalone MDE application. The MDE opens a new workspace using a privileged and password-protected username in the secure workgroup file, opens the database into that workspace, and makes the required changes. Until now, the process has worked just fine.

    Recently, the client has installed a new computer running XP Pro (previous computer was Win2000). Access 97 is installed on the computer and the main applicatioin works properly. However, upon running the database-modifying MDE program, the client was presented with a series of screens where Windows (???) asked him to "Select the Data Source" by identifying the DSN filename to use. The only time I have previously seen such a dialog was via the ODBC setup from Windows Control Panel. I ran the same MDE program on my development computer with no problems (also XP Pro).

    Any idea why this DSN dialog is now being presented and how I can stop it from appearing? Here is code from the update program, but I am not sure whether the program even *gets* to this stage before it displays the "Select Data Source" dialog.


    Public Sub OpenSecure()

    On Error GoTo OpenSecure_Error

    Dim db As DAO.Database, ws As DAO.Workspace
    Dim tdf As DAO.TableDef, fld As DAO.Field, prp As Property
    Dim rs As DAO.Recordset

    Dim strBackEndDatabase As String
    Dim sSQL As String

    'Aug 27, 2004
    Const sOldVer As String = "1.12.09"
    Const sNewVer As String = "1.12.10"

    ' NOTE: this registry setting *should* be correct, but there is a small possibility that it is empty
    strBackEndDatabase = GetSetting("LubeOilDistributionManager", "General", "BackEndDatabase")

    Set ws = DBEngine.CreateWorkspace("Secure", "LODMBEUpdater", "****secureupdaterpassword*****")
    Set db = ws.OpenDatabase(strBackEndDatabase)

    Set rs = db.OpenRecordset("UsysDefaults")
    rs.MoveFirst
    With rs
    If Left(!databaseVersion, 5) <> Left(sOldVer, 5) Then
    MsgBox "Sorry. This update applies only to Backend version " & sOldVer & vbCrLf & _
    "but the version installed on this computer is " & !databaseVersion & vbCrLf & _
    "Contact the author for further instructions."
    Exit Sub
    End If
    End With

    Set tdf = db.TableDefs("uTblVolumeLoadedInCompartment")
    Set fld = New Field
    With fld
    .Type = dbLong
    .DefaultValue = 1
    .Required = True
    .Name = "LectroCountSession "
    End With

    With tdf
    .Fields.Append fld
    End With
    db.TableDefs.Refresh

    Set tdf = db.TableDefs("uTtblTrip")
    With tdf
    .Fields.Append .CreateField("TrailerSuspensionAirPressure ", dbLong)
    End With
    db.TableDefs.Refresh

    ' .... etc....
    End Sub
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access DSN Setup (97)

    When I run your code on my access 2000, I get the dsn dialog at the line :
    Set db = ws.OpenDatabase(strBackEndDatabase)

    I suppose it's because I don't have the registry setting called in :
    strBackEndDatabase = GetSetting("LubeOilDistributionManager", "General", "BackEndDatabase")

    In the comment just above you say the registry setting could be empty.
    Have you checked on the new pc from the client that the registry exist ?
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Vancouver, Br. Columbia, Canada
    Posts
    632
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Access DSN Setup (97)

    Thanks Francois -- that was it. When I deleted the key from the registry on my computer I saw the same results. <img src=/S/bagged.gif border=0 alt=bagged width=22 height=22>

    The comment doesn't actually exist in the code -- I just stuck it into the posting because it popped into my head while I was writing the message. I had recently made a change to the way that I handle the backend relinks, and I had seen a problem in the main application that was also linked to a blank entry. That's what made me think of adding the note. Should have tried on my development machine before posting. <img src=/S/blush.gif border=0 alt=blush width=15 height=15>
    --------------------------------------------------
    Jack MacDonald
    Vancouver, Canada

Posting Permissions

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