Results 1 to 3 of 3
  1. #1
    Star Lounger
    Join Date
    Jan 2002
    Location
    Washington State
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Tables in External Databases (A2k)

    Hi all!

    From within my main database I can work with tables in external databases using DBEngine.Workspaces(0).OpenDatabase(strFileName). I can easily add/edit/delete records, work with tabledef properties, etc. Is it possible to analyze data in these external tables without linking and importing the table into my current database? For example, I would like to be able to find Min, Max, Avg, Sum type values.

    Thanks!
    Sam

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

    Re: Tables in External Databases (A2k)

    You can open a recordset based on an SQL string:

    Dim dbs As DAO.Database
    Dim rst As DAO.Recordset
    Dim strSQL As String
    Set dbs = DBEngine.Workspaces(0).OpenDatabase(strFileName)
    strSQL = "SELECT Max(FieldName) AS MAxVal FROM TableName"
    Set rst = dbs.OpenRecordset(strSQL, dbOpenDynaset)
    MsgBox rst!MaxVal
    rst.Close
    Set rst = Nothing
    dbs.Close
    Set dbs = Nothing

  3. #3
    Star Lounger
    Join Date
    Jan 2002
    Location
    Washington State
    Posts
    69
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Tables in External Databases (A2k)

    Awesome. Thanks again Hans!

Posting Permissions

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