Terima  kasih Pak,
   
  Ketika saya tambahkan Exit Sub pada codingnya pada saat salah satu section 
saya kosong program berhenti, dan ketika saya centang section program tidak mau 
nyimpan dan program terhenti sampai disana ( exit Sub ), bagaimana caranya 
ketika saya centang dari tadinya tidak dicentang, agar supaya programnya lanjut 
menyimpan.
  Tolong bantu.
  Terima kasih.
  Berikut codingnya :
  Private Sub UpdateTrans1()
On Error GoTo iniEror
    Dim i As Integer
    Dim oCO As ADODB.Command
    Set oCO = New ADODB.Command
    Set oCO.ActiveConnection = oConn
    oCO.CommandText = "Update_Trans1"
    oCO.CommandType = adCmdStoredProc
    oCO.Parameters("@no").Value = Text1.Text
    oCO.Parameters("@jam_trs").Value = jam.Text
    oCO.Parameters("@tgl").Value = dtp1.Value
    oCO.Parameters("@user").Value = Text2.Text
    'oCO.Parameters("@dept").Value = Text3.Text
    oCO.Parameters("@keterangan").Value = Text4.Text
    oCO.Parameters("@lokasi").Value = Text6.Text
    oCO.Parameters("@Updates").Value = "Y"
    If OPTJK(0).Value = True Then
        oCO.Parameters("@statuss").Value = "Urgent"
    Else
        oCO.Parameters("@statuss").Value = "Regular"
    End If
    
    If OPTKD(0).Value = True Then
        oCO.Parameters("@kondisi").Value = 0
    Else
        oCO.Parameters("@kondisi").Value = 1
    End If
    
    ' MULAI
kodeLewat = 0
For i = 0 To 6
If CHsection(i).Value = 1 Then
kodeLewat = 1
End If
Next i
  If kodeLewat = 0 Then
MsgBox " Data Section Belum di centang ", vbInformation, "Tolong diisi"
End If
 
    
    oCO.Execute
    
    sSql = " DELETE FROM detail_section " _
         & " WHERE no_mo =  '" & Text1.Text & "'"
    oConn.Execute sSql
    
    For i = 0 To 6
        If CHsection(i).Value = 1 Then
            oCO.CommandText = "pr_tambah_detail_section"
            oCO.CommandType = adCmdStoredProc
            oCO.Parameters("@no_mo").Value = Text1.Text
            oCO.Parameters("@kd_section").Value = CHsection(i).Caption
            oCO.Execute
        End If
    Next i
    
    MsgBox "DATA HAS BEEN UPDATED !", vbInformation, "ATTENTION......."
    Text1.Text = ""
    Text2.Text = ""
    Text4.Text = ""
    Text3.Text = ""
    Text6.Text = ""
    'Label4.Caption = ""
    'Label12.Caption = ""
    dtp1.Value = Date
    jam.Text = Time
    For i = 0 To 6
        CHsection(i).Value = 0
    Next i
    Text1.SetFocus
    'Call SemuaTrans1
    Exit Sub
iniEror:
        MsgBox Err.Description, vbCritical
End Sub
   
   
  
Bace - Bace <[EMAIL PROTECTED]> wrote:
          CHSection adalah Combo Box ? atau check box? klu combo, ngka ada 
value = 0, kupikir check box ya...

tambahkan perintah exit sub pada baris sprti dibawah ini:

' MULAI
For i = 0 To 6
If CHsection(i) .Value = 0 Then
MsgBox " Data Section Belum di centang ", vbInformation, "Tolong diisi"
End If

exit sub

Next i

tapi perintah diatas agak rancu sih menurut ku, soalnya klu ada 6 buah dan 
salah satunya tidak dicentang maka akan muncul pesan "Data Section Belum di 
centang '. Klu menurutku, situasi yang kamu inginkan adalah jika semuanya tidak 
dicentang baru muncul pesan, jika salah satu dicentang, tidak muncul. Jika yang 
itu kamu inginkan rubah kodenya jadi :

' MULAI
kodeLewat = 0
For i = 0 To 6
If CHsection(i) .Value = 1 Then
kodelewat = 1
End If
next

if kodeLewat = 0 then
MsgBox " Data Section Belum di centang ", vbInformation, "Tolong diisi"
end if

'letakkan kode lain disini untuk menjalankan perintah selanjutnya

Semoga membantu: =(oVo)=
====================
BaceInside Publisher
Copyright @2007
Not for reproduced, republished.
Thank You 
====================

----- Original Message ----
From: Kadek Pong <[EMAIL PROTECTED]>
To: [email protected]
Sent: Friday, May 11, 2007 9:26:39 AM
Subject: [indoprog-vb] Tanya Combo Lagi Penting.....

Teman2 saya minta tolong, berikut ini saya tampilkan prosedur Update dan tolong 
di koreksi scriptnya. ( CHSection adalah Combo Box untuk memilih Section )
Pertanyaan saya adalah bagaimana caranya , jika Setion tidak di centang, maka 
keluar pesan " Data Section belum di centang, Tolong diisi ", Selanjutnya 
Program tidak menyimpan langsung ( Saat ini langsung menyimpan baik kosong mau 
diisi Sectionnya langsung Nyimpan ) maunya saya ketika Section tidak dicentang, 
maka user, diberikesempatan untuk mencentang, setelah dicentang sectionnnya 
baru program menyimpan.
Berikut scriptnya.
Private Sub UpdateTrans1( )
On Error GoTo iniEror
Dim i As Integer
Dim oCO As ADODB.Command
Set oCO = New ADODB.Command
Set oCO.ActiveConnectio n = oConn
oCO.CommandText = "Update_Trans1"
oCO.CommandType = adCmdStoredProc
oCO.Parameters( "@no").Value = Text1.Text
oCO.Parameters( "@jam_trs" ).Value = jam.Text
oCO.Parameters( "@tgl").Value = dtp1.Value
oCO.Parameters( "@user"). Value = Text2.Text
'oCO.Parameters( "@dept"). Value = Text3.Text
oCO.Parameters( "@keterangan" ).Value = Text4.Text
oCO.Parameters( "@lokasi" ).Value = Text6.Text
oCO.Parameters( "@Updates" ).Value = "Y"
If OPTJK(0).Value = True Then
oCO.Parameters( "@statuss" ).Value = "Urgent"
Else
oCO.Parameters( "@statuss" ).Value = "Regular"
End If

If OPTKD(0).Value = True Then
oCO.Parameters( "@kondisi" ).Value = 0
Else
oCO.Parameters( "@kondisi" ).Value = 1
End If

' MULAI
For i = 0 To 6
If CHsection(i) .Value = 0 Then
MsgBox " Data Section Belum di centang ", vbInformation, "Tolong diisi"
End If
Next i

oCO.Execute

sSql = " DELETE FROM detail_section " _
& " WHERE no_mo = '" & Text1.Text & "'"
oConn.Execute sSql

For i = 0 To 6
If CHsection(i) .Value = 1 Then
oCO.CommandText = "pr_tambah_detail_ section"
oCO.CommandType = adCmdStoredProc
oCO.Parameters( "@no_mo") .Value = Text1.Text
oCO.Parameters( "@kd_section" ).Value = CHsection(i) .Caption
oCO.Execute
End If
Next i

MsgBox "DATA HAS BEEN UPDATED !", vbInformation, "ATTENTION.. ....."

For i = 0 To 6
CHsection(i) .Value = 0
Next i
Text1.SetFocus
'Call SemuaTrans1
Exit Sub
iniEror:
MsgBox Err.Description, vbCritical
End Sub

------------ --------- --------- ---
Ahhh...imagining that irresistible "new car" smell?
Check outnew cars at Yahoo! Autos.

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

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

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



         

 
---------------------------------
Sucker-punch spam with award-winning protection.
 Try the free Yahoo! Mail Beta.

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

Kirim email ke