Is this possible?

MvP14

Registered User.
Local time
Today, 23:32
Joined
Apr 15, 2003
Messages
66
I have a table with names of persons. They all have a unique ID.

I have a different table with a column which is linked with a one to many relationship to the unique id.

I would like to be able to automatically generate the following:

for every ID in the PersonsTable, I would like eleven records to be created in the linked table that have that ID. In a different column in the linked table, the numbers 1 through eleven should be added for every set of eleven records with the same ID.

Any suggestions will be very much appreciated!

Thanks in advance
 
Generating blank records without good reason isn't recommended, what exactly are you trying to do?
 
Try looking at the sample i posted in this thread. Maybe you can addapt it to suite your needs....

Allthough i do agree with Rich, creating empty records just for the "Heck" of it not good.... You must have a good reason....

Regards

The Mailman
 
The table with the persons contains students that have to be evaluated on eleven tasks. The names of the tasks are in a different table that is linked to the column which has the numbers 1 through eleven. The table in which the records are created have to more columns (score and comments).

When I have created all the records, I'm able to create a form with the students, and a subform with the tasks, score and comments per student. The subform will be filled out during the coming months.

I could create the records manually, but since there are about a hundred students, I hoped for an automatic procedure.
 
if you have an existing table "tasks" and "Students" you can run an append query:

Insert into StudenTasks(StudentID, TaskID)
Select StudentID, TaskID
From Students, Tasks

You might even select the tasks using some form of where clause....

Regards

The Mailman
 
Something like
Dim db As DATABASE
Dim rst As Recordset
Dim I As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("YourChildTable")
rst.MoveFirst
For I = 0 To 11
rst.AddNew
rst!ID = Forms!YourForm!ID
rst.Update
rst.MoveNext

Next I


rst.Close
Set rst = Nothing
db.Close
Set db = Nothing


End Function
 
Thank you!

Yes, that's what I was trying to achieve! Thank you for helping a very unexperienced Querier!
 

Users who are viewing this thread

Back
Top Bottom