If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Append Rows based on field value
I would like to have the append query create a fixed number of rows based on
the value from a field value. For example, field value = 10. I would like my append query to create 10 records. |
#2
|
|||
|
|||
Append Rows based on field value
Bernie wrote:
I would like to have the append query create a fixed number of rows based on the value from a field value. For example, field value = 10. I would like my append query to create 10 records. You could do that using a VBA procedure and add the rows through a record set opened on the destination table. If you want to do it using a query, then create a little utility table called Numbers with one field named Num. Populate the table with records containing 1, 2, 3, ... up to a 100 or whatever. Then the query could look like: INSERT INTO destinationtable (f1, f2, ...) SELECT f1, f2, ... FROM sourcetable, Numbers WHERE fx = keyfieldofrecordtoappend AND Num = fieldvalue -- Marsh MVP [MS Access] |
#3
|
|||
|
|||
Append Rows based on field value
Table CountNumber field CountNUM has number from 0 (zero) through your
maximum spread. INSERT INTO YourTable ( ID, SN ) SELECT [Enter item number] AS Expr1, [Enter Starting Serial #]+[CountNUM] AS Expr2 FROM CountNumber WHERE (((CountNumber.CountNUM)=[Enter qunaity of records]-1)); -- Build a little, test a little. "Bernie" wrote: I would like to have the append query create a fixed number of rows based on the value from a field value. For example, field value = 10. I would like my append query to create 10 records. |
Thread Tools | |
Display Modes | |
|
|