none
Record source for dialog forms RRS feed

  • Question

  • I have an application where I display the same information for several different tables.  This must be a dialog form so that the user completes the task before continuing.  Is there any way to pass the table name to be used in the record source?
    Tuesday, April 9, 2019 1:53 PM

Answers

  • You can pass a string expression as the OpenArgs argument of the OpenForm method of the DoCmd object, and then assign the form's OpenArgs property to its RecordSource property in the form's Open event procedure.

    However, why would you have multiple tables with the same column names?  That sounds like poor relational database design.  If each table is differentiated from the others by some attribute, then a correct model would be a single table with that attribute represented by a column.  The form can then be filtered to the relevant value of the attribute by means of the WhereCondition argument of the OpenForm method, opening the form in dialogue mode by assigning the acDialog constant to the WindowMode argument.

    Ken Sheridan, Stafford, England

    • Marked as answer by RoyLehmann Friday, April 12, 2019 9:49 PM
    Tuesday, April 9, 2019 3:03 PM

All replies

  • You can pass a string expression as the OpenArgs argument of the OpenForm method of the DoCmd object, and then assign the form's OpenArgs property to its RecordSource property in the form's Open event procedure.

    However, why would you have multiple tables with the same column names?  That sounds like poor relational database design.  If each table is differentiated from the others by some attribute, then a correct model would be a single table with that attribute represented by a column.  The form can then be filtered to the relevant value of the attribute by means of the WhereCondition argument of the OpenForm method, opening the form in dialogue mode by assigning the acDialog constant to the WindowMode argument.

    Ken Sheridan, Stafford, England

    • Marked as answer by RoyLehmann Friday, April 12, 2019 9:49 PM
    Tuesday, April 9, 2019 3:03 PM
  • Thank you for your response.  I had 3 membership tables that I wanted to display side by side with the entries sorted by name since I could not depend on the membership number as pointing to same person.  The problem was to create a column to indicate which tables had equal membership numbers.  Problem solved by creating another table linked to the 3 member tables.
    Friday, April 12, 2019 10:05 PM