
Dim DB As New ADODB.Connection
Dim rsF_type As New ADODB.Recordset
Private Sub Command1_Click()
If Trim(Text1.Text) = "" Then
MsgBox "من فضلك ادخل اسم الصنف", vbinformtion, "Organizer Message Center"
Text1.SetFocus
Exit Sub
End If
'
With rsF_type
.AddNew
'
![type_name] = Trim(Text1.Text)
'
.Update
End With
'
rsF_type.Requery
rsF_type.MoveLast
Text1.Text = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
DB.Provider = "Microsoft.JET.OLEDB.4.0;"
DB.Open App.Path & "\Organizer_Stores.mdb"
rsF_type.Open "[F_type]", DB, adOpenStatic, adLockPessimistic
Call LoadKeyboardLayout("00000401", 1)
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Text1_LostFocus()
Dim msg, style, title, response, mystring
msg = "الصنف " & (Text1) & "مسجل من قبل "
style = vbOKOnly + vbCritical
title = "Organizer Message Center"
If Text1.Text = "" Then Exit Sub
If rsF_type.State = adStateOpen Then rsF_type.Close
rsF_type.Open "select* from [F_type] where [type_name]=" & Trim(Text1.Text) & "", DB, adOpenStatic, adLockBatchOptimistic
If rsF_type.RecordCount = 0 Then Exit Sub
If Not rsF_type.RecordCount = 0 Then
MsgBox msg, style, title
Text1.Text = ""
Text1.SetFocus
Exit Sub
End If
End Subعند تشغيل الكود السابق تظهر الرساله المبينه بعاليه
ما هو السبب وما هو الحل .. مع ان نفس الطريقه والاسلوب تم تجريبه اكثر من مره فى برامج اخرى ولم تكن تظهر هذه الرساله
مع التحيه
