Delphi and MS Access lookup value

Posted on 2009-02-17
Last Modified: 2012-06-27
Hi Experts.

Is it possible to get the value of the row source of a MS Access table, inside Delphi?

If possible, how do I implement this value into my Delphi database project, using a normal ADOTable, DataSource and a DBGrid, or any other object.
Question by:Benvor
    LVL 84
    You can use DAO to get to the properties of that table field:

    Dim dbs As DAO.DAtabase
    Dim tdf As DAO.TableDef
    Dim fld As DAO.Field
    Dim i As Integer

    Set dbs = OpenDatabase("Path to your db")
    Set tdf = dbs.TableDefs("YourTableName")
    Set fld = tdf.Fields("YourFieldName")

    For i = 0 to fld.Properties.Count
      If fld.Properties(i).Name = "RowSource" Then
        '/this is the RowSource value
      End If
    Next i

    LVL 22

    Accepted Solution

    Place ADOConnection1 on the form,link it to your MSAccess database using connection string :MS Jet 4 OLE DB provider, Place ADOTable and a Datasource on the form,link ADOTable to your ADOConnection1 (set the ADOConnection1 connected to true,loginprompt false)  ,Table name to your table name,datasource to your table and the grid to your datasource.simple...

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Join & Write a Comment

    Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
    Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
    Familiarize people with the process of utilizing SQL Server views from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Access…
    Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…

    729 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now