Results 1 to 2 of 2
  1. #1
    Lounger
    Join Date
    Feb 2001
    Location
    Trenton, New Jersey, USA
    Posts
    35
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Dbengine not recognized (Access 97)

    We are beginning to have problems with an old database which the agency is in the process upgrading and rewriting.

    Starting today a computer will not recognize Dbengine.Workspace(0).Database(0) in the following code.
    Access 97 is the same on this machine and another that processes this function.

    Function GetCity(zipin As Variant) As Variant

    Dim MyDB As Database ' Declare database.
    Dim ZipCodes As Recordset ' Declare table.
    Set MyDB = DBEngine.Workspaces(0).Databases(0) ' Create database reference.
    Set ZipCodes = MyDB.OpenRecordset("tblZipCodes", DB_OPEN_TABLE) ' table reference.

    On Error GoTo ErrCity

    ZipCodes.Index = "PrimaryKey"
    ZipCodes.Seek "=", zipin

    If ZipCodes.NoMatch Then
    MsgBox ("No match was found for Zip-Code ")
    MyCity = "XXXXXXXXXX"
    MyState = "XX"
    MyCounty = "XXXXXXXXXXXX"
    Else
    MyCity = ZipCodes!City
    MyState = ZipCodes!State
    MyCounty = ZipCodes!County
    End If

    Forms![frmContactType]![Field25] = MyCity
    Forms![frmContactType]![Field27] = MyState
    Forms![frmContactType]![County] = MyCounty

    ZipCodes.Close


    Endit:

    Exit Function
    ErrCity:
    MsgBox ("No match was found for ZipCode2 ")
    Resume Next

    End Function


    Thanks

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Dbengine not recognized (Access 97)

    I assume you've checked for missing references on this computer too? (Cf. <post#=266096>post 266096</post#>)

Posting Permissions

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