Dear Friend,
Mungkin ini bisa membantu, di trik pakai function yang mengembalikan tipe
bertipe boolean.
Sebelum eksekusi Command Store Procedure tambahkan event Funtion
ValidationCheckInput bertipe Boolean.
Private Function ValidationCheckInput() As Boolean
On Error GoTo iniEror
ValidationCheckInput = False
If Trim(Me.text2) = "" Then
Beep
Me. text2.SetFocus
Highlights
Exit Function
End If
If Trim(Me.text7) = "" Then
Beep
Me.text7.SetFocus
Highlights
Exit Function
End If
ValidationCheckInput = True
Exit Function
iniEror:
MsgBox Err.Description, vbCritical
End Function
private Sub Highlights()
With Screen.ActiveForm
If (TypeOf .ActiveControl Is TextBox) Then
.ActiveControl.SelStart = 0
.ActiveControl.SelLength = Len(.ActiveControl)
End If
End With
End Sub
Terus call function diatas with your Command Save like this below :
Private Sub Simpan()
On Error GoTo iniEror
Dim oCO As ADODB.Command
Set oCO = New ADODB.Command
Set oCO.ActiveConnection = oConn
oCO.CommandText = "pr_tambah_Trans2"
oCO.CommandType = adCmdStoredProc
If Not ValidationCheckInput Then
Exit Sub
End If
--- Your statement next
.
Best Regards,
_____
From: Kadek Pong [mailto:[EMAIL PROTECTED]
Sent: 02 Juli 2007 13:18
To: [email protected]
Subject: [indoprog-vb] Tanya Isi pesan jika belum komplit tidak bisa
disimpan
teman 2 minta tolong,
Saya mau isi pesan pada text2.text, jika belum diisi maka keluar pesan data
staff belum diisi dan text7.text jika kosong, maka keluar pesan data guest
belum diisi, tolong diisi.
Jika kolom tsb belum diisi, maka data tidak bisa disimpan dan jika data
sudah diisi, maka data dilajutkan untuk disimpan
Tolong dimana diisi commad tsb
Berikut scriptnya:
Private Sub Simpan()
On Error GoTo iniEror
Dim oCO As ADODB.Command
Set oCO = New ADODB.Command
Set oCO.ActiveConnection = oConn
oCO.CommandText = "pr_tambah_Trans2"
oCO.CommandType = adCmdStoredProc
oCO.Parameters("@no").Value = Text1.Text
oCO.Parameters("@guest").Value = Text2.Text
oCO.Parameters("@tglkirim").Value = dtp1.Value
oCO.Parameters("@kode").Value = Text3.Text
oCO.Parameters("@userkirim").Value = gUser
oCO.Parameters("@personambil").Value = Text4.Text
oCO.Parameters("@jamkirim").Value = Text5.Text
oCO.Parameters("@staff").Value = Text7.Text
oCO.Parameters("@ket").Value = Text6.Text
oCO.Execute
For i = 1 To MSFlexGrid1.Rows - 1
If Trim(MSFlexGrid1.TextMatrix(i, 1)) <> "" Then
oCO.CommandText = "pr_tambah_detail_Trans2"
oCO.CommandType = adCmdStoredProc
oCO.Parameters("@no").Value = Text1.Text
oCO.Parameters("@kode").Value = MSFlexGrid1.TextMatrix(i, 1)
oCO.Parameters("@kirim").Value = MSFlexGrid1.TextMatrix(i, 3)
oCO.Parameters("@balance").Value = MSFlexGrid1.TextMatrix(i, 4)
oCO.Execute
End If
Next i
MsgBox "Data has been Saved...!", vbInformation, "Attention..."
Call Cetak
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = Time
Text6.Text = ""
Label11.Caption = ""
dtp1.Value = Date
Label8.Caption = ""
Text7.Text = ""
MSFlexGrid1.Rows = 2
MSFlexGrid1.TextMatrix(1, 1) = ""
MSFlexGrid1.TextMatrix(1, 2) = ""
MSFlexGrid1.TextMatrix(1, 3) = ""
MSFlexGrid1.TextMatrix(1, 4) = ""
Text1.SetFocus
'Call SemuaKirim
Exit Sub
iniEror:
MsgBox Err.Description, vbCritical
End Sub
---------------------------------
Looking for a deal? Find great prices on flights and hotels with Yahoo!
FareChase.
[Non-text portions of this message have been removed]
[Non-text portions of this message have been removed]