We help IT Professionals succeed at work.
Get Started

How do i fill a 2 Diminisional Array wit data from MS Acess Table

juricta
juricta asked
on
59 Views
Last Modified: 2018-02-02
I have 2xTable (Main and Task).  Main has 1000 records with a FIELD named TaskXAssigned (the X is based on a Task number).  Task has multiple tasks (Fields=ID and Task)

I want to create a DOUBLE FOR loop that will COUNT the number of EACH task assigned (TaskXAssigned).  The OUTSIDE FOR loop counts the number of TASKs in the Task table and the INSIDE FOR loop uses the number of records in the Main table.

EXAMPLE:
I=Dcount(Task table) =25 Tasks...........there are a total of 25 Tasks
Z=Dcount(Maintable)=1000 records.need to find out how many of these have data in TaskXAssigned *where X=1-Dcount)
FOR  vTask=1 TO Dcount (Whatever I equals- # Tasks)
    FOR vRecord=1 TO Dcount (Whatever Z equals - # Reords)

    HELP!!!      'NEED to create a variable for Counter based on Task number (like ctr1 for Task1, ctr2 for Task2, etc)

           vTaskAssigned = "Task" & I & "Assigned"      'This will become Tasl1Assigned, Task2Assigned, etc
           (If IsNull(DLookup(vTaskAssigned, "Main")) Then     'Nothing happens
           ELSE:
                  CREATED counter is incremented by 1  
                  STORE variable and counter in ARRAY
           ENDIF
    NEXT vRecord
NEXT vTask

What I hope to have at the end is something SHOWING me :
  Task1=Counter1 and # of records with Task1Assigned
  Task2=Counter1 and # of records with Task2Assigned
  Task3=Counter1 and # of records with Task3Assigned  etc
A report will be generated :
Task Number              # of Records
1                                       200
2                                       124
3                                        5

Please help!
Comment
Watch Question
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
This problem has been solved!
Unlock 1 Answer and 10 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE