اذهب الي المحتوي
أوفيسنا

الردود الموصى بها

قام بنشر

السلام عليكم اخواني

Ms Access

 عندي مشكلتين الأولى مس ماتش والثانية الكود في حالة البحث عن السجل السابق يرجع لأول سجل فقط وليس للسجل نفسه  لمنع تكرار ثلاثة حقول مختلفة ومجتمعة اذا اختلف واحد منها تصبح مقبولة

وهي كالآتي

حقل تكست

حقل تاريخ

حقل تكست

Private Sub txtDocumentName_AfterUpdate()

Dim NewAccountNo As String
Dim NewDocumentName As String
Dim NewDocumentDate As Date
Dim stLinkCriteria As String
Dim DocNo As Integer

'Assign the entered customer name, Date and  address  to a variable
NewAccountNo = Me.AccountNo.Value
NewDocumentDate = Me.DocumentDate.Value
NewDocumentName = Me.DocumentName.Value

stLinkCriteria = "[AccountNo] = '" & Me.cboAccountNo & _
"' And [DocumentDate] = '" & Me.txtDocumentDate & _
"' And [DocumentName] = '" & Me.txtDocumentName & "'"

If Me.AccountNo = DLookup("[AccountNo]", "tblFacilityRegister", stLinkCriteria) Then
 
   MsgBox "This Account, " & NewAccountNo & ", has already been entered in database." _
              & vbCr & vbCr & "with DocumentDate " & NewDocumentDate & "" _
              & vbCr & vbCr & "with DocumentName " & NewDocumentName & "" _
              & vbCr & vbCr & "Press OK to lead you to the previous record.", vbInformation, "Duplicate information"
     Me.Undo   'undo the process and clear all fields
     Me.Save.Enabled = False
         
    'show the record of matched customer name and address from the customer table
     DocNo = DLookup("[DocNo]", "tblFacilityRegister", stLinkCriteria)
     Me.DataEntry = False
    
     DoCmd.FindRecord DocNo, , , , , acCurrent

End If
End Sub
 

انشئ حساب جديد او قم بتسجيل دخولك لتتمكن من اضافه تعليق جديد

يجب ان تكون عضوا لدينا لتتمكن من التعليق

انشئ حساب جديد

سجل حسابك الجديد لدينا في الموقع بمنتهي السهوله .

سجل حساب جديد

تسجيل دخول

هل تمتلك حساب بالفعل ؟ سجل دخولك من هنا.

سجل دخولك الان
  • تصفح هذا الموضوع مؤخراً   0 اعضاء متواجدين الان

    • لايوجد اعضاء مسجلون يتصفحون هذه الصفحه
×
×
  • اضف...

Important Information