Home > Software engineering >  VB about data table with a new problem
VB about data table with a new problem

Time:09-24

ID OrderNo ProductCode PackageRule PackageLevel OuterQrCodeID

18641, 71101, 00 PTS_001_003 df072-1 1 0

18642, 71101, 00 PTS_001_003 df072-1 1 0

18643, 71101, 00 PTS_001_003 df072-1 1 0

18644, 71101, 00 PTS_001_003 df072-1 1 0

18645, 71101, 00 PTS_001_003 df072-1 1 0

18646, 71101, 00 PTS_001_003 df072-1 1 0

18647 71101 00 PTS_001_003 df072-1 2 0

18648 71101 00 PTS_001_003 df072-1 2 0
As data table, and now want to take the record of OuterQrCodeID PackageLevel=1 in the table updated with PackageLevel ID=2, every three records with a new ID, and a quick print ID (PackageLevel=1)

The updated table:
ID OrderNo ProductCode PackageRule PackageLevel OuterQrCodeID
18641, 71101, 00 PTS_001_003 df072-1 1 18647
18642, 71101, 00 PTS_001_003 df072-1 of 1 18647
18643, 71101, 00 PTS_001_003 df072-1 of 1 18647
18644, 71101, 00 PTS_001_003 df072-1 1 18648
18645, 71101, 00 PTS_001_003 df072-1 of 1 18648
18646, 71101, 00 PTS_001_003 df072-1 of 1 18648
18647, 71101, 00 PTS_001_003 df072-1 2 0
18648, 71101, 00 PTS_001_003 df072-1 2 0

Don't know how to write should be nested, a great god, please help!


 SQL3=SQL3 + "SELECT * FROM TB_pts_product" 
SQL3=SQL3 + "WHERE (ProductCode=N '00 df072-1)"
SQL3=SQL3 + "AND" (OrderNo=N '071101') AND (PackageLevel=1) "
SQL3=SQL3 + "ORDER BY ID"


SQL4=SQL4 + "SELECT * FROM TB_pts_product"
SQL4=SQL4 + "WHERE (ProductCode=N '00 df072-1)"
SQL4=SQL4 + "AND" (OrderNo=N '071101') AND (PackageLevel=2) "
SQL4=SQL4 + "ORDER BY ID"
While Not tRecSql4. EOF
For I=1 To 3
While Not tRecSql3. EOF
LBL=tRecSql3
The Debug. Print LBL
TRecSql3. MoveNext
Wend
Next I
TRecSql4. MoveNext
Wend

CodePudding user response:

You write a nested right, in the for I=1 to 3 have to do is to update the data in this cycle,

CodePudding user response:

reference 1st floor sysdzw response:
your nested right, written in the for I=1 to 3 have to do is to update the data in this cycle,

But the problem is in the first I=1, tRecSql3 data list finished EOF, wait until I=2, there are no data tRecSql3

CodePudding user response:

That will increase your judgments oh, if eof will jump out, otherwise movenext

CodePudding user response:

reference sysdzw reply: 3/f
that will increase your judgments oh, if eof will jump out, otherwise movenext

How to write? Don't!

CodePudding user response:

 
While Not tRecSql4. EOF
While Not tRecSql3. EOF
For I=1 To 3
LBL1=tRecSql3! Id
The Debug. Print LBL & amp; "-" & amp; TRecSql4! Id
TRecSql3. MoveNext
Next I
TRecSql4. MoveNext
Wend
Wend

CodePudding user response:

. While Not tRecSql4 EOF 
While Not tRecSql3. EOF
For I=1 To 3
LBL1=tRecSql3! Id
The Debug. Print LBL & amp; "-" & amp; TRecSql4! Id
If not tRecSql3. Eof then tRecSql3. MoveNext
Next I
TRecSql4. MoveNext
Wend
Wend

CodePudding user response:

Post bar, people in the in the d
  • Related