задача в следующем: есть 2 ListView на одной форме, оба Report. На первом таблица. При двойном клике на элементе из таблицы он должен перемещаться на второй ListView. Делаю так:
- Код: Выделить всё
Option Explicit
Dim Ik As MSComctlLib.ListItem
Dim Ih As MSComctlLib.ListItem
Dim R As String
Private Sub Form_Load()
est
LVPerInj2.ListItems.Clear
End Sub
Private Sub est()
LVPerInj1.ListItems.Clear
Set RS = BD.OpenRecordset("SELECT PhonesObshaya.IDP, PhonesBrand.Brand, PhonesModel.Model, PhonesObshaya.IMEI, PhonesProblem.Problem, PhonesObshaya.Garant FROM PhonesProblem INNER JOIN (PhonesBrand INNER JOIN (PhonesModel INNER JOIN PhonesObshaya ON PhonesModel.ID = PhonesObshaya.Model) ON (PhonesBrand.IDbrand = PhonesObshaya.Brand) AND (PhonesBrand.IDbrand = PhonesModel.Brand)) ON PhonesProblem.IDProb = PhonesObshaya.Problem WHERE IDP<>'" & R & "'")
If Not RS.EOF Then
Do
Set Ik = LVPerInj1.ListItems.Add(, RS!IdP & "'", RS!IdP)
Ik.SubItems(1) = RS!Brand
Ik.SubItems(2) = RS!Model
Ik.SubItems(3) = IIf(IsNull(RS!IMEI) = True, "", RS!IMEI)
Ik.SubItems(4) = RS!Problem
Ik.SubItems(5) = RS!Garant
RS.MoveNext
Loop Until RS.EOF
End If
End Sub
Private Sub LVPerInj1_DblClick()
R = LVPerInj1.SelectedItem.Text
est
nado
End Sub
Private Sub nado()
Set RS = BD.OpenRecordset("SELECT PhonesObshaya.IDP, PhonesBrand.Brand, PhonesModel.Model, PhonesObshaya.IMEI, PhonesProblem.Problem, PhonesObshaya.Garant FROM PhonesProblem INNER JOIN (PhonesBrand INNER JOIN (PhonesModel INNER JOIN PhonesObshaya ON PhonesModel.ID = PhonesObshaya.Model) ON (PhonesBrand.IDbrand = PhonesObshaya.Brand) AND (PhonesBrand.IDbrand = PhonesModel.Brand)) ON PhonesProblem.IDProb = PhonesObshaya.Problem WHERE IDP='" & R & "'")
If Not RS.EOF Then
Do
Set Ih = LVPerInj2.ListItems.Add(, RS!IdP & "'", RS!IdP)
Ih.SubItems(1) = RS!Brand
Ih.SubItems(2) = RS!Model
Ih.SubItems(3) = IIf(IsNull(RS!IMEI) = True, "", RS!IMEI)
Ih.SubItems(4) = RS!Problem
Ih.SubItems(5) = RS!Garant
RS.MoveNext
Loop Until RS.EOF
End If
End Sub
результат - элементы во второй ListView добавляются, но при повторном клике на первом LV, естественно, добавляются "обратно"...
Заранее благодарен