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.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
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]