Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2003
    Posts
    4

    Lightbulb Unanswered: selecting multiple fields on a form to produce a table

    Hello all,
    How do I go about producing a form that allows a user to select from 1-100 fields on the form to then be able to produce a table made up of the selected fields. The fields can come from multiple tables???? Any help would be much appreciated

    dom

  2. #2
    Join Date
    Oct 2002
    Location
    Leicester - UK
    Posts
    820
    the only way i can think of doing this is to have a seperate table that that holds the table name and the primary key in the table

    the do somethink like
    Code:
    Dim destTable As DAO.Recordset, sourceTable As DAO.Recordset, selectionTable As DAO.Recordset
    Set selectionTable = CurrentDb.OpenRecordset("<Table of Fields to be inclued>")
    selectionTable.MoveFirst
    Set destTable = CurrentDb.OpenRecordset("<name of destination>")
    While Not selectionTable.EOF
        Set sourceTable = CurrentDb.OpenRecordset(selectionTable.Fields("TableName"))
        sourceTable.FindFirst "<PrimaryKey> = " & selectionTable.Fields("Key")
        selectionTable.MoveNext
        destTable.AddNew
        For i = 1 To <numberOfFields>
            destTable(i) = sourceTable(i)
        Next
        destTable.update
    Wend
    Definition of a Beginner, Someone who doesn't know the rules.

    Definition of an Expert, Someone who knows when to ignore the rules.

Posting Permissions

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