คุณสมบัติของตาราง
กระทู้เก่าบอร์ด อ.Yeadram

 1,078   1
URL.หัวข้อ / URL
คุณสมบัติของตาราง

คือว่าหนูตั้งค่าตารางเอาไว้
ทั่วไป > จำเป็น : ใช่
ทั่วไป > ใส่ดัชนี : ใช่(ไม่มีค่าซ้ำกัน)

หลังจากนั้น...หนูต้องการจะเช็คถ้าเรากรอกข้อมูลที่ซ้ำไปในหน้าฟอร์ม แล้วให้มันมีข้อความแสดงเช่น "ชื่อซ้ำ กรุณากรอกใหม่" หรืออะไรก็ตามแต่ หลังจากเราเลื่อนแท็บ AfterUpdate()

สองรูปนี้เป็น message จากระบบ ซึ่งหนูจากจะแก้ให้เป็นข้อความที่หนูต้องการ



ใครพอจะมีวิธีทำไหมคะ

1 Reply in this Topic. Dispaly 1 pages and you are on page number 1

1 @R17353

หาเจอหล่ะ =.=!



Private Sub txtCustomerCode_BeforeUpdate(Cancel As Integer)

    Dim SID As String
    Dim stLinkCriteria As String
    Dim rsc As DAO.Recordset

    Set rsc = Me.RecordsetClone

    SID = Me.txtCustomerCode.Value
    stLinkCriteria = "[customer_code]=" & "'" & SID & "'"

    'Check customer table for duplicate customer code
    If DCount("customer_code", "customer", _
              stLinkCriteria) > 0 Then
        'Undo duplicate entry
        Me.Undo
        'Message box warning of duplication
        MsgBox "Warning Customer Code " _
             & SID & " has already been entered." _
             & vbCr & vbCr & "You will now been taken to the record.", _
               vbInformation, "Duplicate Information"
        'Go to record of original Customer Code
        rsc.FindFirst stLinkCriteria
        Me.Bookmark = rsc.Bookmark
    End If

    Set rsc = Nothing
End Sub
@ ประกาศใช้งานเว็บบอร์ดใหม่ => บอร์ดเรียนรู้ Access สำหรับคนไทย
แล้วจะใส่ลิ้งอ้างอิงมาที่โพสต์เก่านี้หรือไม่ก็ตามสะดวกครับ
Time: 0.1970s