Forum Discussion

FJMSalgueiro's avatar
FJMSalgueiro
Copper Contributor
Apr 15, 2025
Solved

Criteria for a query

I have a database containing multiple records, and I want to create a query that allows the user to specify how many times the records should be displayed. This should be done without duplicating the...
  • Kidd_Ip's avatar
    Apr 21, 2025

    Take this:

     

    1. Create a Helper Table

    • Name it tblNumbers
    • Add a single field Num (Integer Type)
    • Populate it with sequential numbers (1, 2, 3, … up to a reasonable maximum)

    2. Create a Query to Dynamically Duplicate Rows

    SELECT YourTable.Date, YourTable.Code, YourTable.Description
    FROM YourTable, tblNumbers
    WHERE tblNumbers.Num <= [Enter Number of Duplicates];
    • The [Enter Number of Duplicates] prompt will ask the user for the number of times they want each record to appear.
    • The tblNumbers.Num <= ensures that only the specified number of duplicates is included.

Resources