coding dibawah ini hanya sebagai contoh, bukan merupakan coding lengkap.

Private Sub IsiDataDepartemen()
Dim RsD As ADODB.Recordset
Dim strRs As String
Dim itemLv As ListItem
Dim Indx As Long
    
    On Error GoTo ErrCabang
   
    Set RsD = New ADODB.Recordset
    strRs = "Select msd_kode, msd_nama, msd_mscb_kode, mscb_nama from 
ms_departemen, ms_cabang where msd_mscb_kode = mscb_kode order by msd_nama"
    RsD.CursorLocation = adUseClient
    RsD.CacheSize = 120
    RsD.Open strRs, ConMSSQL, adOpenKeyset, adLockReadOnly
    
    Indx = 0
    
    With RsD
        If (Not .BOF) And (Not .EOF) Then
            .MoveFirst
            Do While Not .EOF
                Indx = Indx + 1
              'LvDepartemen adalah nama object listviewnya '
                Set itemLv = LvDepartemen.ListItems.Add(, "ID" & CStr(Indx), 
CStr(!msd_kode))
                itemLv.SubItems(1) = IIf(IsNull(!MSd_Nama), "", 
Trim(!MSd_Nama)) '!
                itemLv.SubItems(2) = IIf(IsNull(!msd_MScb_kode), "", 
Trim(!msd_MScb_kode)) '!
                itemLv.SubItems(3) = IIf(IsNull(!MScb_nama), "", 
Trim(!MScb_nama))
                .MoveNext
            Loop
        End If
    End With
    RsD.Close
    Set RsD = Nothing
    Exit Sub
    
ErrCabang:
    If Err.Number <> 0 Then
        MsgBox "Kesalahan Nomor : " & Err.Number & vbCrLf & _
               "Keterangan : " & Err.Description, vbOKOnly + vbExclamation, 
"Data Master Departemen"
    End If
End Sub

Smoga bermanfaat
Basmal


      
____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 


[Non-text portions of this message have been removed]

Kirim email ke