please help on this project

tonymat

New member
Local time
Today, 06:24
Joined
Jun 6, 2005
Messages
9
I have project in which i need a sweeptake. I want to have two table one table is ahving field 1 as numbers from 1 to 100,FIELD 2 NUMBER AT RANOM(3,4,9,23,43) .The other table have two field first field is ID number and other name.

I have form which has a textbox and command button. i put a number in text box and click on the command and i want to check whether this number excists in the first table ,if excists add field 2 numbers until that number in field 1 and i want that number used as the id number in other table and find name.If the sum exceeds the id number i want to rotate ,start from up again.


For example

Table 1

no numer

1 2
2 1
3 2
4 4

Table 2

Id number Name

1 mildred
2 VICTOR
3 SAM
4 MATHEW
5 dracula


iF enter 3 on text box it should add until 3 in first table ie 2+1+2=5 and take this 5 and find in the second table . THE NAME IS DRACULA WITH ID NUMBER 5 ID NUMBER

iF enter 4 on text box it should add until 4 in first table ie 2+1+2+4=9 and take this 9 and find in the second table .THE TABLE SHOULD COMPLETE 5 AND THEN AGAIN START FROM 1 .tHE ANSWER WILL BE MATHEW.
 
How much do you know VBA?

Open table1 in a recordset
while total < [typed in number]
total = total + currentrecord.[no]
move to next record
wend
grab [numer] off this record

open table2 in a recordset
move down [numer] Mod table2.Rows.Count
grab the name off that record

HTH
 
Last edited:
If you are just trying to select random names you could get Access to do that for you.

Peter
 

Users who are viewing this thread

Back
Top Bottom