Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Nov 2001
    Location
    Sydney, New South Wales, Australia
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Relationships Code (2003 SP3)

    Each month I get a dump into Access of a SQL Server database containing about 100 tables and I need to define a large number of relationships in order to produce specific Access reports. Is there code I can use to make the job of creating relationships easier?

    Thanks

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

    Re: Relationships Code (2003 SP3)

    Make sure that you have a reference (in Tools | References in the Visual Basic Editor) to the Microsoft DAO 3.6 Object Library.
    The DAO Database object has a CreateRelation method. its Syntax is

    Function CreateRelation(<!t>[Name], <!t>[Table], <!t>[ForeignTable], <!t>[Attributes]) As Relation

    See the DAO help for more info, and ACC97: Sample DAO Code to Create a Many-to-Many Relationship for an example.

Posting Permissions

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