prevents users from using the SHIFT key to bypass
กระทู้เก่าบอร์ด อ.Yeadram

 3,713   9
URL.หัวข้อ / URL
prevents users from using the SHIFT key to bypass

ผมไปอ่านเจอมาของ Microsoft เกี่ยวกับการป้องกัน user กด shift
1.     In Visual Basic for Applications (VBA), set the AllowBypassKey property to False. This prevents users from using the SHIFT key to bypass the settings in the Startup dialog box. For information about how to set the AllowBypassKey property, search the Microsoft Access Visual Basic Reference Help index for "AllowBypassKey property." You can also set the startup options and properties used in this procedure (as well as other startup options and properties) from VBA code. For information about how to do this, search the Microsoft Access Visual Basic Reference Help index for "Startup properties."
อันนี้เป็นส่วนหนึ่งนะครับ
เนื่องจากความไม่สันทัดภาษาอังกฤษของผม เลยยังไม่รู้ว่ามันป้องกันได้จริงหรือเปล่า

แล้วก็เลยเอามา post ถามว่าใครพอมีประสบการ์ณ หรือมีวิธีป้องกันการกด shift แบบได้ผลจริงๆหรือเปล่าครับ

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

1 @R02064
มีโปรแกรมแก้ครับ
2 @R02066
เอ้าอย่างนี้ ถ้าไม่ใช้โปรแกรมแก้แสดงว่ามันกันได้จริงหรือครับ
ช่วยอธิบายโดยละเอียดหน่อยได้ไหมครับ ว่าใช้โปรแกรมอะไรแก้ได้

ว่าแต่ผมยังทำไม่เป็นเลยครับ วิธีป้องกัน shift มีตัวอย่างที่ทำแล้วไหมครับ
3 @R02067
ใช้ DAO 3.6 ด้วยนะครับ
Dim MyDb As Database      
Set MyDb = OpenDatabase(Text0)      
MsgBox ("disable set, result = " & ChangeProperty("AllowBypassKey", dbBoolean, False, MyDb))





Option Compare Database
Option Explicit
' This code is from the Access. Web
' check out:
'
Function ChangeProperty(strPropName As String, _
                   varPropType As Variant, _
                   varPropValue As Variant, _
                   dbs As Database) As Integer
' The current listing in Access help file which will
' let anyone who can open the db delete/reset any
' property created by using this function, since
' the call to CraeteProperty doesn't use the DDL
' argument
'
Dim prp As Property
Const conPropNotFoundError = 3270

'Set dbs = CurrentDb
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True

Change_Bye:
Exit Function

Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
        varPropType, varPropValue)
dbs.Properties.Append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
4 @R02092
ไม่เข้าใจครับ
แล้วจะเอา code เหล่านี้ไปวางที่ไหนครับ
module หรือ ที่ form ไหน
แล้วมันจะทำงานอย่างไรครับ
5 @R02093
สร้าง mdb มาอีกตัวก็ได้ครับ เอาฟังก์ชั่นไปวางในโมดูล (อย่าลืม add library DAO 3.6)

สร้างฟอร์มมา 1ตัว มี textbox
ใส่พาธของไฟล์ที่ต้องการล็อกใน textbox
มีปุ่มคำสั่ง
เมื่อคลิ๊กที่ปุ่มคำสั่ง
Dim MyDb As Database       
Set MyDb = OpenDatabase(Text0)       
MsgBox ("disable set, result = " & ChangeProperty("AllowBypassKey", dbBoolean, False, MyDb))

ตัวที่จะถูกล็อกไม่ใช่ตัวที่ทำงานอยู่ ณ ปัจจุบันนะครับ แต่เป็นตัวที่ ชื่อมันอยู่ใน textbox และ... ขณะที่ตัวนี้กำลังทำงาน mdb ตัวเป้าหมายต้องไม่รันอยู่ในขณะนั้น
6 @R02095
Work ครับ
ขอบคุณมาก ใช่ที่หาเลยทีเดียว
ว่าแต่ ถ้าไม่ใช้โปรแกรมแก้ ก็ไม่มีทางกด shift เพื่อ bypass เข้าไปได้แล้วใช่ใหมครับ

อีกอย่างไม่จำเป็นต้อง run access ตัวที่เขียนคำสั่งไว้ทุกครั้งใช่ไหมครับ

สุดท้าย MS DAO 3.6 ส่วนใหญ่ของผมมันจะ on อยู่แล้วไม่แน่ใจว่า
โดยปกติมันเป็นอย่างไรหรือครับ

ขอบคุณมากๆอีกครั้ง
7 @R02096
- บางทีก็อาจจะมีโปรแกรมอื่นมาช่วยแก้ ครับใช่ถ้าไม่ใช้โปรแกรมอื่นมาแก้ก็ไม่มีทางกด shift ได้ แต่ โค้ดที่ให้ มันก็ดาบสองมนะครับ เพราะมันแค่ True กับ False เท่านั้นเอง

- เมื่อตั้งค่าตัวเป้าหมายแล้ว mdb ตัวที่รันโค้ด ก็ไม่ต้องรันอีกครับ เอาไปทิ้งหรือเอาไปซ่อนดีๆ เลยครับ อิอิ เพราะตัวนี้แหละครับ มันใช้แก้กลับได้

-Access 2000-2002    DAO 3.6 จะไม่ถูกติดตั้งอัตโนมัติครับ
-Access 97, 2003, 2007 จะถูกติดตั้งอัตโนมัติอยู่แล้วครับ
8 @R02101
ขอบคุณมาก อีกทีครับ
เท่านี้ก็พอเพียงแล้วครับ...

ในระดับ user การกด shift เพื่อ bypass เริ่มเป็นที่รู้จักมากขึ้นแล้ว
แต่เข้าใจว่าการเขียน code หรือ การหาโปรแกรม เพื่อมาแก้... การป้องกันการกด shift น่าจะยังไม่แพร่หลายเท่าไหร่

9 @R20471
Add DAO 3.6 ใน Access 2007 แล้วขึ้นแบบนี้ หมายความว่าอย่างไรครับ

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