reading just now and then a value from another database

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Michiel Rapati-Kekkonen

    reading just now and then a value from another database

    hi,

    every now and then I want to compare a field in a local table to a field in
    a table in another database.
    but not by linking it permanently.

    what would be the simplest approach

    thanks for your suggestions

    michiel


  • Mark

    #2
    Re: reading just now and then a value from another database

    A little code like this -----

    Dim DB As DAO.Database
    Set DB = Path to your external database
    Dim Rst As DAO.Recordset
    Set Rst = DB.OpenRecordse t("Name Of Table In External database")

    Now you can compare in a form that has its recordsource as the local
    table ---
    If Me!NameOfFieldI nLocalTable = Rst!NameOfCorre spondingFieldIn External Table

    Finally Close DB and Rst
    Rst.Close
    Set Rst = Nothing
    Set DB = Nothing

    Steve


    "Michiel Rapati-Kekkonen" <nn@nonsense.zz wrote in message
    news:97d3k.199$ kl3.194@read4.i net.fi...
    hi,
    >
    every now and then I want to compare a field in a local table to a field
    in a table in another database.
    but not by linking it permanently.
    >
    what would be the simplest approach
    >
    thanks for your suggestions
    >
    michiel
    >
    >

    Comment

    • Michiel Rapati-Kekkonen

      #3
      Re: reading just now and then a value from another database

      thanks very much:
      that works perfectly,
      albeit that you cannot take 'path to your external database' to literally.
      I had more success with
      set DB = DBEngine.Worksp aces(0).OpenDat abase('path to your external
      database')

      but you set me in the right direction
      thanks again

      michiel


      "Mark" <notmy@email.co mwrote in message
      news:xtmdnYRrR9 DG-tDVnZ2dnUVZ_gad nZ2d@earthlink. com...
      >A little code like this -----
      >
      Dim DB As DAO.Database
      Set DB = Path to your external database
      Dim Rst As DAO.Recordset
      Set Rst = DB.OpenRecordse t("Name Of Table In External database")
      >
      Now you can compare in a form that has its recordsource as the local
      table ---
      If Me!NameOfFieldI nLocalTable = Rst!NameOfCorre spondingFieldIn External
      Table
      >
      Finally Close DB and Rst
      Rst.Close
      Set Rst = Nothing
      Set DB = Nothing
      >
      Steve
      >
      >
      "Michiel Rapati-Kekkonen" <nn@nonsense.zz wrote in message
      news:97d3k.199$ kl3.194@read4.i net.fi...
      >hi,
      >>
      >every now and then I want to compare a field in a local table to a field
      >in a table in another database.
      >but not by linking it permanently.
      >>
      >what would be the simplest approach
      >>
      >thanks for your suggestions
      >>
      >michiel
      >>
      >>
      >
      >
      >

      Comment

      Working...