Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - Please help me read the VB code of excel report output from the access table.
Please help me read the VB code of excel report output from the access table.
You have written too much. See if the following code inspires you?

First, query and fill in the "Operation Name" and count it in combo 1:

Rs 1.open "Select different process names from tmpdata", db, 1, 1.

rs 1.movefirst

do while not eof(rs 1)

Combo1.additemr1.fields ("process name")

rs 1.movenext

ring

When clicking combo 1, query and fill in "Work Step Name" and count it in combo2:

"Dim row" line number

sub combo 1_click()

row=row+ 1

Active sheet. Cells (row, 1) = combo 1.text' Write "process name" in the column of sheet 1.

rs2 . open " select distinct step name FROM tmpData where operation name = ' " &; combo 1 . text & amp; “,db, 1, 1

rs2.movefirst

do while not eof(rs2)

Combo2.additem rs2.fields ("step name")

rs2.movenext

ring

End joint

Click combo2 to query and fill in the "Tool Name" and fill it in the third column of sheet 1:

sub combo2_click()

Active sheet. Cells (row, 1) = combo2.text' Write "step name" in the second column of sheet 1.

rs3 . open " select tool name FROM tmpData where process name = ' " &; combo 1 . text & amp; And step name =' "&; combo 2 . text & amp; “,db, 1, 1

rs3.movefirst

do while not eof(rs3)

Activesheet.cells (row, 3) = rs3.fields ("tool name").

row=row+ 1

rs3.movenext

ring

The cell combination of the second column and the first column can be written by myself, so I will omit it.

Output a table for each process name and change the active table every time. If all the outputs are in the same table, add some statements.

End joint