R
Richard
I have created a database that is working rather well but would like to
cleanup my VB code some.
In a table I have 50 fields that contain a department number and 50 fields
that have a task number. Below is the code I have had to use. I wanted to
setup a loop but that code gives me a <Item not found in this Collection.>
error.
What I have
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs1 = db.OpenRecordset("Job", DB_OPEN_SNAPSHOT)
Found = "No"
Do Until rs1.EOF
If rs1!JOB_ID = JOBNUM Then
Found = "Yes"
deptnum(1) = rs1!DEPT_NO_1
tasknums(1) = rs1!Task_No_1
deptnum(2) = rs1!DEPT_NO_2
tasknums(2) = rs1!Task_No_2
deptnum(3) = rs1!DEPT_NO_3
tasknums(3) = rs1!Task_No_3
deptnum(4) = rs1!DEPT_NO_4
Rest of code. . . . . . .
What I am trying but not working!
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs1 = db.OpenRecordset("Job", DB_OPEN_SNAPSHOT)
Found = "No"
Do Until rs1.EOF
If rs1!JOB_ID = JOBNUM Then
Found = "Yes"
For k = 1 To 50
deptnum(k) = rs1!DEPT_NO_(k)
tasknums(k) = rs1!Task_No_(k)
Next k
Forms![Select Tracking].Status = rs1!Status
End If
rs1.MoveNext
Loop
If any of you can lead me in the right direction, I would greatly appreciate
it.
RC
(e-mail address removed)
cleanup my VB code some.
In a table I have 50 fields that contain a department number and 50 fields
that have a task number. Below is the code I have had to use. I wanted to
setup a loop but that code gives me a <Item not found in this Collection.>
error.
What I have
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs1 = db.OpenRecordset("Job", DB_OPEN_SNAPSHOT)
Found = "No"
Do Until rs1.EOF
If rs1!JOB_ID = JOBNUM Then
Found = "Yes"
deptnum(1) = rs1!DEPT_NO_1
tasknums(1) = rs1!Task_No_1
deptnum(2) = rs1!DEPT_NO_2
tasknums(2) = rs1!Task_No_2
deptnum(3) = rs1!DEPT_NO_3
tasknums(3) = rs1!Task_No_3
deptnum(4) = rs1!DEPT_NO_4
Rest of code. . . . . . .
What I am trying but not working!
Set db = DBEngine.Workspaces(0).Databases(0)
Set rs1 = db.OpenRecordset("Job", DB_OPEN_SNAPSHOT)
Found = "No"
Do Until rs1.EOF
If rs1!JOB_ID = JOBNUM Then
Found = "Yes"
For k = 1 To 50
deptnum(k) = rs1!DEPT_NO_(k)
tasknums(k) = rs1!Task_No_(k)
Next k
Forms![Select Tracking].Status = rs1!Status
End If
rs1.MoveNext
Loop
If any of you can lead me in the right direction, I would greatly appreciate
it.
RC
(e-mail address removed)