Pagi juga,
Jika akan cek no_nota tersebut telah ada atau belum, dengan query pada
variabel sCari sudah mewakili. Jika RecordCount > 0 berarti no_nota tersebut
telah terpakai dan user diberi peringatan. Sampai disini, telah membuat
bagian If RCari("no_nota") = Text1.Text Then bisa dihilangkan.
Jika ingin tetap mencoba mencari record per record hasil query, maka harus
dilakukan loop dari BOF sampai EOF, dan pada setiap loop dicek dengan baris
yang If RCari("no_nota") = Text1.Text Then
Hanya saja, dengan query sCari, sudah tahu apakah sudah ada atau belum.
Mungkin begitu,
Kid
2009/3/11 *SåôyÈ* <[email protected]>
> Pagi master semua,
> saya ada sedikit problem nih, maklum pemula :)
> Begini saya mencoba menyimpan data nomor nota, begitu nomor nota
> kesimpan, kita masukin lagi nomor nota tesebut,
> Supaya nomor nota tersebut tidak dobel, gimana ya caranya.
>
> Kesalahan yg muncul seperti dibawah.
>
> Run time error \3021'
>
> either BOF or EOF is true, or the current record has been deleted.
> request operation requires a current record
>
> Saya mencoba membuat perintah seperti dibawah, database yg digunakan mysql.
>
> Private Sub Text1_lostfocus()
> If Text1.Text = "" Then Exit Sub
> SCari = "select * from data where No_nota= '" + Trim(Text1.Text) + "'"
> Set RCari = New ADODB.Recordset
> RCari.Open SCari, CN, adOpenKeyset, adLockReadOnly
> If RCari.RecordCount <> 0 Then
> If RCari("no_nota") = Text1.Text Then
> MsgBox "Nomor Sudah Dipakai", vbOKOnly, "PERHATIAN"
> Text1.SetFocus
> End If
> Exit Sub
> End If
> RCari.Close
> Set RCari = Nothing
> End Sub
>
> Mohon bantuannya rekan-rekan.
> Makasih
>
> SH
> .
>
>
>
[Non-text portions of this message have been removed]
------------------------------------
Untuk berhenti berlangganan kirim email kosong ke :
[email protected].
Untuk forum diskusi lainnya kunjungi :
http://www.geocities.com/indoprog
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/indoprog-vb/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/indoprog-vb/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[email protected]
mailto:[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/