how can 1 make a combination of 6 digits out of 40 numbers (1-40)

  • Follow


how can 1 make a combination of 6 digits out of 40 numbers (1-40)
1
Reply Utf 11/25/2009 4:39:01 PM

Can you explain a little more what you are trying to do?

-- 
Build a little, test a little.


"sundy" wrote:

> how can 1 make a combination of 6 digits out of 40 numbers (1-40)
0
Reply Utf 11/25/2009 4:48:14 PM

On Wed, 25 Nov 2009 08:39:01 -0800, sundy <sundy@discussions.microsoft.com>
wrote:

>how can 1 make a combination of 6 digits out of 40 numbers (1-40)

A 'digit' is a single numeric character - 39 is two digits. Do you want six
*digits* or a set of six numbers, as you would get with a Lotto game?

If the latter, you can get all 2763633600 possible combinations by using a
table Num with one number field N, manually filled with values 1 to 40. The
query would be a "Cartesian join" - just add the Num table to the query six
times, selecting N for each; Access will alias the instances to Num, Num_1,
Num_2 and so on. In the criteria for Num_1.N put 

> Num.N

In the criteria for Num_2.N put

> Num_1.N

and so on up to Num_6.N; this will prevent duplicates.

DON'T print this query unless you own stock in the company that makes toner
for your printer!

If you want just a (single) random set of six numbers, there are tricks to do
so...
-- 

             John W. Vinson [MVP]
0
Reply John 11/25/2009 6:40:01 PM

If you are wanting a Lotto type list on 6 numbers then I found that it was 
too large for Access 2007 to handle.  Calculating 40 to the 6th power is 
4096000000.

If you want to try then this is SQL using table named CallData and field Num 
containing number 1 through 40 and no number duplicated in a field of same 
recrord --
SELECT CallData.Num AS POS1, CallData_1.Num AS POS2, CallData_2.Num AS POS3, 
CallData_3.Num AS POS4, CallData_4.Num AS POS5, CallData_5.Num AS POS6
FROM CallData, CallData AS CallData_1, CallData AS CallData_2, CallData AS 
CallData_3, CallData AS CallData_4, CallData AS CallData_5
WHERE (((CallData.Num)<>[CallData_1].[Num] And 
(CallData.Num)<>[CallData_2].[Num] And (CallData.Num)<>[CallData_3].[Num] And 
(CallData.Num)<>[CallData_4].[Num] And (CallData.Num)<>[CallData_5].[Num]) 
AND ((CallData_1.Num)<>[CallData].[Num] And 
(CallData_1.Num)<>[CallData_2].[Num] And (CallData_1.Num)<>[CallData_3].[Num] 
And (CallData_1.Num)<>[CallData_4].[Num] And 
(CallData_1.Num)<>[CallData_5].[Num]) AND ((CallData_2.Num)<>[CallData].[Num] 
And (CallData_2.Num)<>[CallData_1].[Num] And 
(CallData_2.Num)<>[CallData_3].[Num] And (CallData_2.Num)<>[CallData_4].[Num] 
And (CallData_2.Num)<>[CallData_5].[Num]) AND 
((CallData_3.Num)<>[CallData].[Num] And (CallData_3.Num)<>[CallData_2].[Num] 
And (CallData_3.Num)<>[CallData_1].[Num] And 
(CallData_3.Num)<>[CallData_4].[Num] And 
(CallData_3.Num)<>[CallData_5].[Num]) AND ((CallData_4.Num)<>[CallData].[Num] 
And (CallData_4.Num)<>[CallData_2].[Num] And 
(CallData_4.Num)<>[CallData_3].[Num] And (CallData_4.Num)<>[CallData_1].[Num] 
And (CallData_4.Num)<>[CallData_5].[Num]) AND 
((CallData_5.Num)<>[CallData].[Num] And (CallData_5.Num)<>[CallData_2].[Num] 
And (CallData_5.Num)<>[CallData_3].[Num] And 
(CallData_5.Num)<>[CallData_4].[Num] And 
(CallData_5.Num)<>[CallData_1].[Num]));

-- 
Build a little, test a little.


"KARL DEWEY" wrote:

> Can you explain a little more what you are trying to do?
> 
> -- 
> Build a little, test a little.
> 
> 
> "sundy" wrote:
> 
> > how can 1 make a combination of 6 digits out of 40 numbers (1-40)
0
Reply Utf 11/25/2009 7:02:21 PM

3 Replies
1216 Views

(page loaded in 0.087 seconds)

6/12/2014 1:04:35 AM


Reply: