Imprimir página | Cerrar ventana

Proteger Base de Datos

Impreso de: Foro de Access y VBA
Categoría: Access y VBA
Nombre del foro: Access y VBA
Descripción del foro: Foro de programacion en Access (Con código y sin código)
URL: http://www.mvp-access.com/foro/forum_posts.asp?TID=86947
Fecha de impresión: 26/Marzo/2026 a las 19:25


Tema: Proteger Base de Datos
Publicado por: M3talzoneDGD
Asunto: Proteger Base de Datos
Fecha de publicación: 11/Junio/2024 a las 19:38
Buenas tardes

Lo mismo este tema está en algun post aclarado pero con la busqueda no lo he encontrada. El tema es que, yo tengo una BBDD de Access que comparto con otra persona, tengo el frontend y el backend. El tema es, para ingresar en la BBDD lo primero que se abre es un formulario de Login y dependiendo del user que se elija habre un menu u otro. Lo que me gustaria saber es, hay forma de que si el que entra en la BBDD no es el Administrador se desactive directamente el boton derecho del mouse? otra. Hay forma de proteger para que no abran la BBDD pulsadon la tecla Shift del teclado, o poner un password para poder acceder pulsando la tecla shift?

Muchas gracias por todo.




Respuestas:
Publicado por: mounir
Fecha de publicación: 12/Junio/2024 a las 11:15
Hola!

1- Para desactivar el botón derecho del mouse:-

https://learn.microsoft.com/es-es/office/vba/api/access.form.shortcutmenu" rel="nofollow - https://learn.microsoft.com/es-es/office/vba/api/access.form.shortcutmenu

2- Crea un botón en un formulario menú por ejemplo y pon el evento ala hacer Clic:-

Private Sub Cmd_Mantenimiento_Click()
If InputBox("Clave?", "Bloqueo de BD") = "123456" Then
    ap_EnableShift
    
Else
    ap_DisableShift
    
End If
End Sub



Function ap_DisableShift()
'This function disable the shift at startup. This action causes
'the Autoexec macro and Startup properties to always be executed.

On Error GoTo errDisableShift

Dim db As DAO.Database
Dim prop As DAO.Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line disables the shift key on startup.
db.Properties("AllowByPassKey") = False

'The function is successful.
Exit Function

errDisableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, False)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If

End Function

Function ap_EnableShift()
'This function enables the SHIFT key at startup. This action causes
'the Autoexec macro and the Startup properties to be bypassed
'if the user holds down the SHIFT key when the user opens the database.

On Error GoTo errEnableShift

Dim db As DAO.Database
Dim prop As DAO.Property
Const conPropNotFound = 3270

Set db = CurrentDb()

'This next line of code disables the SHIFT key on startup.
db.Properties("AllowByPassKey") = True

'function successful
Exit Function

errEnableShift:
'The first part of this error routine creates the "AllowByPassKey
'property if it does not exist.
If Err = conPropNotFound Then
Set prop = db.CreateProperty("AllowByPassKey", _
dbBoolean, True)
db.Properties.Append prop
Resume Next
Else
MsgBox "Function 'ap_DisableShift' did not complete successfully."
Exit Function
End If

End Function







-------------
Un Saludo.


Publicado por: javier.mil
Fecha de publicación: 12/Junio/2024 a las 17:51
Pegale un vistazo la demo 4 de mi WEB
https://www.accessdemo.info" rel="nofollow - https://www.accessdemo.info


-------------
https://www.accessdemo.info" rel="nofollow - https://www.accessdemo.info






Imprimir página | Cerrar ventana