copy data from one table to another based on condition

C

cliff

Hi, I am new to access. I have problem in adding data from table from
another based on certain condtions :-

Mydata table is something like :-

numvalue numcount
16 4
23 4
39 4
8 3
15 3
37 3
41 3

Now I want to copy top 2 numvalues into another table called mytblvalues
assign ruleid is 1 and mytblvalue is something like this :-

ruleid numvalue
1 16
1 23

now I want to copy top 5 numvalues and assign rulveid 2 and mytblvalues is

rulevid numvalue
1 16
1 23
2 16
2 23
2 39
2 8
2 15

now I want copy top 10 numvalues from mydata into mytblvalues and assign
ruleid 3. But, there are only 7 numvalue in mydata table, it should copy
only 7 numvalues.


and mytblvalues is something like this :-
ruleid numvalue
1 16
1 23
2 16
2 23
2 39
2 8
2 15
3 16
3 23
3 39
3 8
3 15
3 37
3 41


could you help to write code for the ojective


thank you very much

cliff
 
M

Mike Painter

I'd want a bit more information about the actual use of this information.
Either that or a note from you instructor.
 
C

cliff

Hi

Basically I want to select 5 random nos from 1 to 31. But I want restrict
them on certain criterias. Therefore in my tbl_rule I set minimum and
Maximum nos for particular group and i want to use only those nos which
fulfill the criterias :-

my tbl_rule is something like this :_

ruleid ruledescr rulemin rulemax
1 top2 0 2
2 top5 0 3
3 top10 2 3

therefore,suppose 5 randomly generated numbers are 16,23,35,42,47 if
fufills above condtions then they will saved in table called tblrndstore


please help me to write code for copying data

thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top