How to Replace the Default Input Mask Error Message
กระทู้เก่าบอร์ด อ.สุภาพ ไชยา

 229   1
URL.หัวข้อ / URL
How to Replace the Default Input Mask Error Message

มีคนถามไว้ที่ 
http://www.utteraccess.com/forums/showflat.php?Cat=&Board=access_97&Number=109614&Forum=CatSearch-2&Words=mask&Match=Entire%20Phrase&Searchpage=0&Limit=25&Old=2days&Main=109614&Search=true#Post109614 
 
เขาถามไว้ว่า 
is there any way I can "override" or define my own error message when an  
input mask has not been met? 
 
I tried setting up a validation rule but access keeps showing me the inputmask  
error which I dont want since it sort of interrupts my program flow...im designing  
an application in access 
 
thanks for the help 
 
ต้องการจะระงับการแสดงข้อความเตือนเมื่อใส่ข้อความในช่อง Input Mask ไม่ถูกต้อง จะทำอย่างไร 
เขาพูดถึงทางออกไว้ค่อนข้างดีครับ 
 
ผมเลยนึกถึงบทความของ Microsoft เองที่ได้เขียนเกี่ยวกับเรื่องนี้ไว้ที่ 
http://support.microsoft.com/default.aspx?scid=kb;en-us;q120567 
 
แต่ผมจะเพิ่มโค้ดเข้าไปเพื่อสร้างสิ่งที่ได้พิมพ์ลงไปด้วย เพื่อให้สามารถข้ามไปรายการอื่นได้ 
 
โค้ดของผมจะเป็นดังนี้ครับ 
 
Private Sub Form_Error(DataErr As Integer, Response As Integer) 
    Const INPUTMASK_VIOLATION = 2279 
    If DataErr = INPUTMASK_VIOLATION Then 
        MsgBox "ใส่หมายเลขโทรศัพท์ไม่ถูก" & vbCrLf & _ 
                "ต้องเป็นแบบ " & Me.Text0.InputMask, vbOKOnly, "ใส่หมายเลขไม่ถูก" 
        Response = acDataErrContinue 
        ' ยกเลิกค่าที่ได้พิมพ์ลงไป ทำหน้าที่เหมือนกด Esc 2 ครั้งติดกัน 
        DoCmd.RunCommand acCmdUndo 
        DoCmd.RunCommand acCmdUndo 
    End If 
End Sub

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

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