Group:  Microsoft Access ยป microsoft.public.access.formscoding
Thread: copy data from one table to another based on condition

Geek News

copy data from one table to another based on condition
cliff 11/17/2008 3:17:03 PM
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
Re: copy data from one table to another based on condition
"Mike Painter" <mddotpainter[ at ]sbcglobal.net> 11/17/2008 5:23:36 PM
I'd want a bit more information about the actual use of this information.
Either that or a note from you instructor.

cliff wrote:
[Quoted Text]
> 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


Re: copy data from one table to another based on condition
cliff 11/17/2008 5:47:02 PM
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


Home | Search | Terms | Imprint Contact
Newsgroups Reader - provided by WiredBox.Net