Appending multiple records (1 Viewer)

AChir

Registered User.
Local time
Today, 07:23
Joined
Oct 4, 2001
Messages
51
I have a form containing data as follows
SchYear
Subject
GpBased (Yes/No)
GpCount

At the press of a button, I'd like to be able to append new records to a separate table, "Classes", where the key field, SubjSetCode, is filled with:
SchYear & "/" & Subject1
SchYear & "/" & Subject2
SchYear & "/" & Subject3
and so on up to whatever number is given in GpCount

Can anyone point me in the right direction, please? I can append single records but can;t get it to manage multiple ones

Thank you
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 02:23
Joined
Feb 19, 2002
Messages
43,668
I can't figure out where subject1, subject2, etc. are coming from.

FYI, It is poor practice to store concatenated fields. If you want to make a compound key, do it by:
1. select the first field of the pk
2. hold the cntl key and select up to 9 additional fields.
3. when all the required fields are highlighted, press the key icon on the toolbar.
 

AChir

Registered User.
Local time
Today, 07:23
Joined
Oct 4, 2001
Messages
51
Thank you for the feedback. I can see what you mean about concatenated fields. When I tried to use a compound key I got in a mess when I tried to use a bound column in a list box, so at the moment I still have it set up using, as you rightly say, poor practice.

Added to that, I have explained myself badly, too. What I am trying to do is let the user enter data in 4 fields:

Schyear: 6, Subject: Ma, GpCount: 6, GpBased: Yes
Schyear: 5, Subject: Ma, GpCount: 3, GpBased: No
Schyear: 5, Subject: En, GpCount: 3, GpBased: Yes
And so on

Then I wanted to be able to set something up so that a command button created new records in my “Classes” table just where GpBased is “Yes”. So the SubjSetCode in successive records of the Classes table would go:

6/Ma1
6/Ma2
6/Ma3

6/Ma6
5/En1
5/En2…

Thanks again for your help. If what I am doing is totally daft, I could start again, but my problem is partly that I am trying to adapt a database I alraedy have for someone else, so it is set up badly already
 

Users who are viewing this thread

Top Bottom