اذهب الي المحتوي
أوفيسنا
بحث مخصص من جوجل فى أوفيسنا
Custom Search

منع تكرار ثلاثة حقول مختلفة


alhakeem1977

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

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

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
 

رابط هذا التعليق
شارك

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

زائر
اضف رد علي هذا الموضوع....

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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

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

Important Information