sunshine737
asked on
how can i bring in two record sets in one while not
Hello,
i need to display values from two tables
so i made two queries with two record sets
so how can i use both the recor sets in same while not loop, when im using and its not giving the results
can somebody please help, thanks
rec1.Open "SELECT anska.kostdet_mek_l2.ang_n r,anska.ko stdet_mek_ l2.ver_nr, anska.kost det_mek_l2 .stn_nr, anska.kostdet_mek_l2.line_ nr,anska.k ostdet_mek _l2.kon_at mo, anska.kostdet_mek_l2.entw_ atmo, anska.kostdet_ele_l2.kon_h w, anska.kostdet_ele_l2.messt _app, anska.kostdet_ele_l2.entw_ atmo, anska.kostdet_ele_l2.visio n_atmo, anska.kostdet_ele_l2.kon_s w, anska.kostdet_ele_l2.auspr _funkt_atm o, anska.kostdet_mek_l2.monta ge, anska.kostdet_mek_l2.auspr _atmo, anska.kostdet_ele_l2.instl ln, anska.kostdet_ele_l2.schsc hr_atmo, anska.kostdet_ele_l2.funkt _atmo, anska.kostdet_mek_l2.proz_ atmo, anska.kostdet_mek_l2.prufg _anlag_atm o, anska.kostdet_mek_l2.proje ktleitung FROM anska.kostdet_mek_l2, anska.kostdet_ele_l2 WHERE anska.kostdet_mek_l2.ang_n r(+) = anska.kostdet_ele_l2.ang_n r AND anska.kostdet_mek_l2.ver_n r(+) = anska.kostdet_ele_l2.ver_n r AND anska.kostdet_mek_l2.line_ nr(+) = anska.kostdet_ele_l2.line_ nr and anska.kostdet_mek_l2.ang_n r ='" & sel & "'", conn1
rec3.Open "SELECT kostdet.ang_nr, kostdet.ver_nr, kostdet.stn_nr, kostdet.line_nr, anska.work_sta.stn_desc, kostdet.ges_preis FROM kostdet, anska.work_sta WHERE kostdet.ang_nr = anska.work_sta.ang_nr AND kostdet.ang_nr = '" & sel & "'", conn1
While Not rec1.EOF And rec3.BOF
j = j + 1
Tabelle2.Cells(j, 3) = (rec3.Fields("stn_nr").Val ue)
Tabelle2.Cells(j, 4) = (rec3.Fields("line_nr").Va lue)
Tabelle2.Cells(j, 5) = (rec3.Fields("stn_desc").V alue)
Tabelle2.Cells(j, 7) = (rec3.Fields("ges_preis"). Value)
Tabelle2.Cells(j, 9) = (rec1.Fields("kon_atmo").V alue)
Tabelle2.Cells(j, 10) = (rec1.Fields("entw_atmo"). Value)
Tabelle2.Cells(j, 11) = (rec1.Fields("kon_hw").Val ue)
Tabelle2.Cells(j, 12) = (rec1.Fields("messt_app"). Value)
Range("z:A" & j).Select
Selection.ClearOutline
Selection.Rows.Group
Tabelle2.Cells(j, 1).EntireRow.Select
With Selection.Interior
.ColorIndex = xlNone
.Pattern = xlSolid
End With
rec1.MoveNext
Selection.HorizontalAlignm ent = xlCenter
Selection.Font.Bold = True
Wend
z = j + 1
rec2.MoveNext
rec1.MoveFirst
Wend
j = j + 1
Range("z:A" & j).Select
'Selection.ClearOutline
Selection.Rows.Group
thanks in advance
i need to display values from two tables
so i made two queries with two record sets
so how can i use both the recor sets in same while not loop, when im using and its not giving the results
can somebody please help, thanks
rec1.Open "SELECT anska.kostdet_mek_l2.ang_n
rec3.Open "SELECT kostdet.ang_nr, kostdet.ver_nr, kostdet.stn_nr, kostdet.line_nr, anska.work_sta.stn_desc, kostdet.ges_preis FROM kostdet, anska.work_sta WHERE kostdet.ang_nr = anska.work_sta.ang_nr AND kostdet.ang_nr = '" & sel & "'", conn1
While Not rec1.EOF And rec3.BOF
j = j + 1
Tabelle2.Cells(j, 3) = (rec3.Fields("stn_nr").Val
Tabelle2.Cells(j, 4) = (rec3.Fields("line_nr").Va
Tabelle2.Cells(j, 5) = (rec3.Fields("stn_desc").V
Tabelle2.Cells(j, 7) = (rec3.Fields("ges_preis").
Tabelle2.Cells(j, 9) = (rec1.Fields("kon_atmo").V
Tabelle2.Cells(j, 10) = (rec1.Fields("entw_atmo").
Tabelle2.Cells(j, 11) = (rec1.Fields("kon_hw").Val
Tabelle2.Cells(j, 12) = (rec1.Fields("messt_app").
Range("z:A" & j).Select
Selection.ClearOutline
Selection.Rows.Group
Tabelle2.Cells(j, 1).EntireRow.Select
With Selection.Interior
.ColorIndex = xlNone
.Pattern = xlSolid
End With
rec1.MoveNext
Selection.HorizontalAlignm
Selection.Font.Bold = True
Wend
z = j + 1
rec2.MoveNext
rec1.MoveFirst
Wend
j = j + 1
Range("z:A" & j).Select
'Selection.ClearOutline
Selection.Rows.Group
thanks in advance
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.